I'm having trouble running some Selenium tests on a Jenkins Slave. To be specific, the display resolution that is used to run the tests is too small, causing some of the tests to fail.
To check the display resolution, we log the display height and width to the console, using:
driver.manage().window().maximize();
System.out.println("Window height: " + driver.manage().window().getSize().getHeight());
System.out.println("Window width: " + driver.manage().window().getSize().getWidth());
This returns:
Window height: 784
Window width: 1040
which seems like a very strange resolution to me. The desired resolution is 1920 x 1080.
The server that is used as a slave is a virtual machine (Windows Server 2012 R2). The Jenkins Slave is Connected via JNLP agent. The slave has the service running with Log On As "Local System" with the "Allow service to interact with desktop" option enabled.
So far we've tried a number of things like:
All of these didn't resolve the issues. Suggestions are very welcome!
I'm having trouble running some Selenium tests on a Jenkins Slave. To be specific, the display resolution that is used to run the tests is too small, causing some of the tests to fail. To check the display resolution, we log the display height and width to the console, using:
By default, all Selenium tests on desktop run on a screen resolution of 1920x1080. You can use our custom resolution capability which lets you specify a different screen resolution for your tests. Note: Browser window is not maximized upon launch in any Selenium test. Changing the resolution will not maximize browser.
To check the display resolution, we log the display height and width to the console, using: which seems like a very strange resolution to me. The desired resolution is 1920 x 1080. The server that is used as a slave is a virtual machine (Windows Server 2012 R2). The Jenkins Slave is Connected via JNLP agent.
How to setup Selenium on a Linux VM. 1 Step 1. Whenever y o u get a new Linux machine, always update the packages first. Then install the necessary dependencies. 2 Step 2. 3 Step 3.
Finally managed to fix these issues after realizing that Jenkins does not necessarily need to run the slaves as a windows service. To start the slave, the JNLP agent can be downloaded from Jenkins and copied to the server. When running the JNLP file, you can select for the option to install the slave agent as a service.
Previously we had this option selected, that's why the slave was running as a service. After stopping and removing the service, we ran the JNLP file again and made sure to not select the option.
The solutions suggested that included disconnecting the remote desktop session and leaving the session open with a large resolution didn't work when running the slave as a service. They do work however when running the slave in the default way.
Make sure that the remote desktop session is not ended after a certain period of time:
Hope this helps someone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With