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

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


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!


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')