I have my regression suite setup in jenkins and it executes on windows server 2012 r2. Recently I changed screen resolution to 1920,1080 by using below code
driver.manage().window().setSize(new Dimension(1920,1080));
All the other test scripts get passed except two ( let's say script1 and script2 ) in headless mode on the server. But those two scrips get passed in my local machine in both headless and browser mode.
And also when I execute those two scripts in browser mode on the server with the same screen resolution, again they get passed.
When I change the screen resolution to
driver.manage().window().setSize(new Dimension(1366,768));
It get passed on the server in headless mode.
Since I'm using the same configurations for the rest of the scripts. I couldn't think of an exact thing happening here. When I build the Jenkins job, it executes all the other scripts and when it comes to script1 execution hangs. Jenkins build also hangs and doesn't come to the end. Looking for a solution for this.
I'm using webdrivermanager and chrome version of the server is 96
I did troubleshoot and here are my findings,
So that's the reason those scripts work in small screen resolution and failed in higher resolutions
I changed the loop accordingly and now I can execute all the scripts with higher resolution on the server with headless mode