Hello there!
For the purpose of verifying the font size of a CSS element on getbootstrap.com using Selenium in the Firefox browser, I rely on this particular script:
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Selenium::Firefox;
my $url = 'http://getbootstrap.com';
my $driver = Selenium::Firefox->new();
$driver->get($url);
my $elt = $driver->find_element(
'h1.mb-3.fw-semibold', 'css');
is $elt->get_css_attribute('font-size'), '72px',
'Masthead font size is unchanged';
$driver->quit();
done_testing;
Upon running the script, the test unfortunately does not pass:
❯ ./selenium_properties_css_attribute.pl
not ok 1 - Masthead font size is unchanged
# Failed test 'Masthead font size is unchanged'
# at ./selenium_properties_css_attribute.pl line 12.
# got: '64px'
# expected: '72px'
1..1
Killing Driver PID 4132 listening on port 45685...
# Looks like you failed 1 test of 1.
I would appreciate insights on why the aforementioned test is failing. Despite confirming a font size of 72px for the h1.mb-3.fw-semibold element on getbootstrap.com in the Computed tab within the Firefox browser, we are observing a result of 64px during the test execution. What could be causing this discrepancy?
An included screenshot showcases the font size as being 72px: