How to set window size in Selenium Chrome Python

前端 未结 3 587
甜味超标
甜味超标 2020-11-27 07:36

The following code to resize a selenium chrome window does not work:

driver.set_window_size(1920, 1080)
time.sleep(5)
size = driver.get_window_size()
print(\         


        
3条回答
  •  感动是毒
    2020-11-27 08:12

    Instead of

    options.add_argument("--window-size=1920,1080")
    

    Can you please try this.

    options.add_argument('window-size=1920x1080');
    

    OR

    options.add_argument("--start-maximized")
    

提交回复
热议问题