Timeout Error occurred When run a script on Headless chrome browser by using Selenium Webdriver with Python

前端 未结 2 436
暗喜
暗喜 2021-02-10 05:07

When I am running python scripts to test a website on Headless Chrome Broswer (Webdriver + Selenium), we often get a timeout error, I found out the problem occu

2条回答
  •  不思量自难忘°
    2021-02-10 05:32

    I was having a similar problem, normal Chrome driver worked fine, but headless chrome always timed out.

    I found out that for responsive web pages, you need to set the window size:

    driver.set_window_size(1200, 600)
    

    It worked after adding this line just after initialization of the driver itself.

    I hope this helps!

提交回复
热议问题