简体   繁体   中英

How to maximize window in Jenkins using Python, Selenium Webdriver and Chromedriver?

How to maximize a window in Jenkins? I tried to maximize window using:

chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--start-maximized")
self.driver = webdriver.Chrome(chrome_options=chromeOptions)


driver.maximize_window()

driver.set_window_size(1920,1080)

driver.fullscreen_window()

All works when I run the test in PyCharm, but in Jenkins, the window does not change size.

The problem is with Jenkins running as a windows service.

In Windows command prompt, go to folder where jenkins-cli.jar file is located.

And stop the service.

java -jar jenkins-cli.jar -s http://localhost:8080 safe-shutdown --username "YourUsername" 
--password "YourPassword"

Have Jenkins run from the command prompt using a script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM