Home > Back-end >  Couple of Cucumber scripts failed due to a higher screen resolution - JAVA
Couple of Cucumber scripts failed due to a higher screen resolution - JAVA

Time:11-21

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

CodePudding user response:

By default, VM screen size is very small (--window-size=1040,784), so while automating things, decrease your screen size to this value and automate, otherwise, we will face this issue.

To increase VM screen size, you need to increase virtual memory of your R2 server. that will end up with high cost.

solution:

  1. Automate with smaller screen size.
  2. or Run it in headless mode

CodePudding user response:

I did troubleshoot and here are my findings,

  1. It was a loop which was never ending if element not found
  2. inside the loop, it searches for an element which was appeared only in a small screen resolutions (arrow button to navigate through some tabs. when the screen resolution is higher, all the tabs appear in the page and no arrow button visible)

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

  • Related