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

前端 未结 2 472
暗喜
暗喜 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:24

    I faced same issue and was able to resolve it after updating my chromedriver and adding chrome_options.add_argument("--window-size=1920,1080") to the chrome options. The options I currently apply are:

    chrome_options = Options()  
    chrome_options.add_argument("--headless") 
    chrome_options.add_argument("--window-size=1920,1080")
    chrome_options.add_argument('--start-maximized')
    chrome_options.add_argument('--disable-gpu')
    chrome_options.add_argument('--no-sandbox')
    chrome_options.add_argument("--disable-extensions")
    chrome_options.add_argument('disable-infobars')
    

提交回复
热议问题