How to set window size in Selenium Chrome Python

前端 未结 3 578
甜味超标
甜味超标 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:28

    So I finally figured out what the problem is: Running Windows task scheduler with option 'run whether user is logged on or not' only opens a small browser (1024x768) that CANNOT be resized, even with all the great suggestions being offered here.

    See the same issue resolved here: screen resolution in mode "Run whether user is logged on or not", in windows task scheduler

    So the less than ideal workaround is to only run when user is logged on.

    Thanks for all your help!

提交回复
热议问题