I have been working with BDD Test automation since 3 years now that used Neodymium 4.1.5 version with Java 11. recently since 2 months I am facing issue with Chrome Headless mode execution where browser size is not maximized which use to worked all fine earlier. Due this element clicks are not functioning as it would hidden or need to be scrolled either way. Non Headless mode works all fine without any issue. Issue is reproducible in local and also on Jenkins agent as well. I am unable to figure out the root cause for this issue, we have chrome 138.x version , and I se with Selenium 4.x it has capability to detect and download the required version chrome driver..
Properties we set up are as below
browserprofile.Chrome.name=Chrome
browserprofile.Chrome.browser=chrome
browserprofile.Chrome.browserResolution=1920x1080
browserprofile.Chrome.headless=true
browserprofile.Chrome.arguments=-ignore-certificate-errors --disable-gpu
neodymium.url=https://${neodymium.url.host}
neodymium.url.host= <hostname>
neodymium.locale=en-US
neodymium.debugUtils.highlight=true
neodymium.debugUtils.highlight.duration=100
neodymium.allureAddons.screenshots.perstep.always=true
neodymium.webDriver.reuseDriver=false
neodymium.webDriver.keepBrowserOpen=false
neodymium.webDriver.keepBrowserOpenOnFailure=false
neodymium.selenideAddons.staleElement.retry.count=2
neodymium.selenideAddons.staleElement.retry.timeout=10000
neodymium.webDriver.window.width=1920
neodymium.webDriver.window.height=1080
@Before
public void before(Scenario scenario) throws IOException {
var driverVersion = System.getenv("DRIVER_VERSION");
var browserVersion = System.getenv("BROWSER_VERSION");
if (driverVersion != null) {
WebDriverManager.chromedriver()
.driverVersion(driverVersion)
.browserVersion(browserVersion)
.setup();
} else {
WebDriverManager.chromedriver().setup();
}
WebDriverUtils.setUp("Chrome");
TimezoneUtils.setTimezoneDiffInSecondsFromProperties();
TrustAllCertificates.install();
currentScenario = scenario;
if (scenario.getStatus() == Status.UNDEFINED) {
throw new PendingException("Scenario has undefined steps: " + scenario.getName());
}
}
There was an update in Chrome for changing window size in headless mode: https://issues.chromium.org/issues/423334494
You now need to use the --screen-info
argument. For example:
--screen-info={0,0 1920x1080}
You will need to pass this arg to Chrome yourself or fix the browserResolution
property in the client bindings you are using to accommodate this change.