3

I am trying to get screenshots of a large map and I am occasionally running into the timeout exception during the execution of the save_screenshot function. It's hard to identify exactly what is causing it, although I observe that the exception occurs when the screenshot I am attempting to take is especially large (eg 10000 x 7200).

It's not a page load timeout, because I am still able to open the url and interact with elements. The exception is being caught when I take a screenshot (ie driver.save_screenshot(filename))).

This is the error message I'm getting:

timeout: Timed out receiving message from renderer: 8.743
  (Session info: headless chrome=80.0.3987.163)

What I have tried so far:

  • checking that my chromedriver, chrome browser and selenium client (python) are all up to date (source): I am using Chromium 80.0.3987.163, ChromeDriver 80.0.3987.106, and Selenium 3.141.0.
  • setting the following options (sources 1, 2, 3):
options.add_argument('--ignore-certificate-errors')
options.add_argument('--incognito')
options.add_argument('--no-sandbox')
options.add_argument('--enable-automation')
options.add_argument('--disable-gpu')
options.add_argument('--disable-infobars')
options.add_argument('--disable-browser-side-navigation')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--disable-features=VizDisplayCompositor')
options.add_argument('--dns-prefetch-disable')
options.add_argument('--headless')

Any pointers to resolving this issue are very welcome!

sngoh
  • 56
  • 5

1 Answers1

1

Found the answer specifically to this problem (I had the same issue!)

https://stackoverflow.com/a/56364166/15567914

basically add this to the options:

options.add_argument("--force-device-scale-factor=1")
Claudio Batista
  • 286
  • 1
  • 9