change the default resolution for UI testing with jenkins

I'm trying to run UI automation with a Jenkins job that runs on a windows VM as a jenkins slave, as a part of a CI pipeline. I have a problem that the screen resolution is set to be very low (1024, 768) how can I change the default resolution, so that when jenkins opens a new connection it will be with a larger resolution?


run >> services.msc >> stop the system service which you want to change resolution (Jenkins.exe) >> right click >> Properties >> Log On TAB >> Local System Account >> Check Allow service to interact with Desktop >> then it will take the resolution of the monitor you currently use.

Make sure you put browser.driver.manage().window().maximize(); on the your onPrepare: metod of protractor.conf.js


Do you have your webapp container started as a local service (tomcat or jenkins slave?). The point is that windows services cannot have GUI and it's even a miracle, that WebDriver somehow manages to open a 1024,768 window :) Start your webapp container as a console application with a normal user.


Theoretically, running powerscript command as the build step:

 set-displayresolution 1920 1080 -Force

should do it, but I have some problems with right now...

What has definitely worked: connect to your VM with RDP using desired resolution, then disconnect. The tests will run in the last resolution used.

链接地址: http://www.djcxy.com/p/36850.html

上一篇: 我如何调整我的WPF应用程序的屏幕分辨率?

下一篇: 用jenkins更改UI测试的默认分辨率