99

After Chrome released their newest version yesterday (64.0.3282), I am now receiving this error rather sporadically:

Timed out receiving message from renderer: 600.000

I'm running about 2,000 selenium tests within a docker container and I see this failure at a rate of about 1 in 100. There are no reproducible steps as far as I can tell- the tests that fail are different with each iteration. I updated to the newest Chromedriver (2.35), but that didn't seem to have any effect. I was previously using Selenium 2.41, but have updated to the newest version (3.8.1) hoping that it might help... it did not. I'm completely at a loss as to why this might be occurring. Has anyone else noticed this? Is it possibly a bug with Chrome's newest release?

Thank you in advance for any help you may be able to provide.

Brandon Schabell
  • 1,735
  • 2
  • 10
  • 21
  • I am seeing this same issue in Jenkins using since the selenium/standalone-chrome docker image was updated ~20 days ago. A visit to the first page works, but a visit to any other page after fails with the same message above. The tests worked fine for more than a year before the image update. – dansalmo Feb 14 '18 at 17:56
  • Same image/Chrome driver works perfectly on my local machine. Only fails in Jenkins. – dansalmo Feb 14 '18 at 18:17
  • 4
    It is happening in chromedriver v80 – Muzzamil Feb 11 '20 at 10:59
  • Just to add my experience with the same issue: the problem was that I was not exiting the driver at the end of the script, so a missing `driver.quit()` was the culprit. You can see if this is the case for you by checking if there are still running chromedriver executables. – Sohail Apr 23 '21 at 15:57
  • Hi Brandon, I'm still facing this issue in 2022 ))) can't find the root cause and solution for a couple of weeks already )) Did you have a chance to solve the problem? – Arman Avetisyan Dec 20 '22 at 02:08

22 Answers22

124

Check for JS Runtime

First verify you aren't executing / eval()ing a lot of javascript. That can cause a timeout.

Check Version Compatibility

First, verify your versions of:

  • Selenium
  • JDK
  • ChromeDriver
  • Chrome

are all compatible. Good luck doing this because there is no single place that documents it, AND selenium software isn't smart enough to do a quick check (it should)

Check Driver Initialization

Add this cryptic block of code, what I like to call the "Ever Growing List of Useless Arguments" chromedriver requires

up to date from every issue ever reported on stack overflow as of: September 2018

// ChromeDriver is just AWFUL because every version or two it breaks unless you pass cryptic arguments
//AGRESSIVE: options.setPageLoadStrategy(PageLoadStrategy.NONE); // https://www.skptricks.com/2018/08/timed-out-receiving-message-from-renderer-selenium.html
options.addArguments("start-maximized"); // https://stackoverflow.com/a/26283818/1689770
options.addArguments("enable-automation"); // https://stackoverflow.com/a/43840128/1689770
options.addArguments("--headless"); // only if you are ACTUALLY running headless
options.addArguments("--no-sandbox"); //https://stackoverflow.com/a/50725918/1689770
options.addArguments("--disable-dev-shm-usage"); //https://stackoverflow.com/a/50725918/1689770
options.addArguments("--disable-browser-side-navigation"); //https://stackoverflow.com/a/49123152/1689770
options.addArguments("--disable-gpu"); //https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc
driver = new ChromeDriver(options);

//This option was deprecated, see https://sqa.stackexchange.com/questions/32444/how-to-disable-infobar-from-chrome
//options.addArguments("--disable-infobars"); //https://stackoverflow.com/a/43840128/1689770

Sources:

Falko
  • 17,076
  • 13
  • 60
  • 105
Jonathan
  • 6,741
  • 7
  • 52
  • 69
  • 7
    Good job with the detailed list of fixes. The --disable-gpu option worked for me and I now have screen shot after hours of messing around with 4 lines of code. If you are running Linux on a VM this option makes web driver work. – rtn Oct 22 '18 at 22:28
  • Related: If your screenshots are black, it can also be that your host is Windows with a locked screen – Jonathan Dec 11 '18 at 20:02
  • Brilliant! Unfortunately I still see the problem sometimes, it's just rarer. For my purposes I'm switching to the Firefox `geckodriver`, works perfectly. – kontextify Jun 19 '19 at 08:03
  • Great list, `disable-browser-side-navigation`, `disable-infobars` and `disable-dev-shm-usage` were the missing options in our project. Now there are no timeouts in Chrome 75. – Neurotransmitter Jul 01 '19 at 14:58
  • We need to have a community supported page similar to this post which outlines the best options to use for a given chrome version. – Marcel Wilson Aug 29 '19 at 15:13
  • 4
    It seems to be spending too much time executing js, try this `driver.manage().timeouts().pageLoadTimeout(30L, TimeUnit.SECONDS)` , `driver.manage().timeouts().setScriptTimeout(3L, TimeUnit.SECONDS)`. Note that pageLoadTimeout is as large as scriptTimeout – xmcx Nov 04 '19 at 07:54
  • 1
    If you added `disable-features=VizDisplayCompositor` before, you need to remove that in Chrome 79 or this will come back. – Ryan Shillington Dec 13 '19 at 18:16
  • @Jonathan You can also add `--incognito`. This seems to resolve most issues. If you're talking about awful, the whole industry is awful because all these corporates aren't testing their products thoroughly and instead constantly rushing to the market. – Mugen Aug 06 '20 at 05:52
  • The PageLoadStrategy did the trick for me. It seems like you only have to be extra careful with Waits. I had no other problems besides that. Thanks! – Vinícius Queiroz Jan 02 '21 at 22:56
  • This is my list -- `options.addArguments("--window-size=1366,768"); options.addArguments("--no-sandbox"); options.addArguments("--disable-gpu"); options.addArguments("--enable-javascript"); options.addArguments("disable-infobars"); options.addArguments("--disable-infobars"); options.addArguments("--single-process"); options.addArguments("--disable-extensions"); options.addArguments("--disable-dev-shm-usage"); options.addArguments("--headless"); options.addArguments("enable-automation"); options.addArguments("--disable-browser-side-navigation");` – Sunny Tambi Jan 07 '21 at 18:09
  • In python it should be "add_argument" instead of "addArguments". – Carst3n Feb 09 '22 at 10:40
  • @xmcx What is the different between `driver.manage().timeouts().pageLoadTimeout(30L, TimeUnit.SECONDS)` and `driver.set_page_load_timeout(30.0)`? – pmor May 22 '23 at 10:53
  • @pmor I don't think they are any different, other than the language (mine is Java). – xmcx May 23 '23 at 18:39
  • Ah, the first one is for JS. I've overlooked it. – pmor May 24 '23 at 11:24
  • @SunnyTambi be very cautious with `"--single-process"`, as it was a source of reproducible errors in my tests (`Message: disconnected: Unable to receive message from renderer (failed to check if window was closed: disconnected: not connected to DevTools)`). – mirekphd Jul 09 '23 at 08:57
18

I had this issue today, with Chrome: Version 73.0.3683.86 (Official Build) (64-bit). For me it was failing on the timeouts on Jenkins builds, and was fine locally, see the following Chrome options that helped me to overcome that issue (ChromeDriver at this time: version - 73.0.3683.68):

ChromeOptions options = new ChromeOptions();
options.addArguments("enable-automation");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
options.addArguments("--no-sandbox");
options.addArguments("--disable-extensions");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--disable-gpu");
options.setPageLoadStrategy(PageLoadStrategy.NORMAL);
Community
  • 1
  • 1
Alex Podimov
  • 181
  • 1
  • 4
  • What Selenium Chrome Driver version are you using? I am using 2.53 and `setPageLoadStrategy` is not a method of the `ChromeOptions`class. – hfontanez Apr 03 '19 at 14:43
  • I upgraded to Selenium-java version 3.141.59 and tried these options and it worked for me as well. I am still using Chrome web driver version 2.45.615291. – hfontanez Apr 03 '19 at 16:47
  • that's the Chrome browser version. That's the same I am using. – hfontanez Apr 05 '19 at 16:17
  • 1
    I have customized the version using this guide: http://chromedriver.chromium.org/downloads/version-selection using these available for download: http://chromedriver.chromium.org/downloads – Alex Podimov Apr 09 '19 at 00:03
14

Root cause: Whenever you are loading some page with the help of selenium driver,  then driver script wait till page is completely loaded. But sometime webdriver takes more time to load page, in that case you will see TimeoutException exception in your console.

Solution: When Page Loading takes too much time for wait so we will wait for the DOMContentLoaded event with page load strategy. This page load strategy is called Eager. A small definition of available all 3 pageload strategies.

1. normal: This strategy causes Selenium to wait for the full page loading (html content and sub resources downloaded and parsed).

2. eager : This strategy causes Selenium to wait for the DOMContentLoaded event (html content downloaded and parsed only).

3. none : This strategy causes Selenium to return immediately after the initial page content is fully received (html content downloaded).

NOTE : By default, when Selenium loads a page, it follows the normal pageLoadStrategy.

Code snippet without using Pageload strategy (Or Normal as used by selenium by default)

System.setProperty("webdriver.chrome.driver", "C:\\Users\\...\\LatestDriver\\chromedriver.exe");   
WebDriver driver=new ChromeDriver();
driver.get("http://www.google.com");
driver.manage().window().maximize();
WebDriverWait wait = new WebDriverWait(driver, 20);
WebElement el = wait.until(ExpectedConditions.elementToBeClickable(By.name("q")));
el.click();
List <WebElement> allLinks = driver.findElements(By.tagName("a"));
System.out.println(allLinks.size());
driver.quit();

Console Output:

Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port 41540 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Feb 11, 2020 10:22:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C [1581412933.937][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.066][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.168][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.360][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.461][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.618][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.719][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.820][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412934.922][SEVERE]: Timed out receiving message from renderer: 0.100 [1581412935.097][SEVERE]: Timed out receiving message from renderer: 0.100 21

With PageLoad Strategy - Eager - Code Snippet:

System.setProperty("webdriver.chrome.driver", "C:\\Users\\...\\LatestDriver\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setPageLoadStrategy(PageLoadStrategy.EAGER);
WebDriver driver=new ChromeDriver(options);
driver.get("http://www.google.com");
driver.manage().window().maximize();
WebDriverWait wait = new WebDriverWait(driver, 20);
WebElement el = wait.until(ExpectedConditions.elementToBeClickable(By.name("q")));
el.click();
List <WebElement> allLinks = driver.findElements(By.tagName("a"));
System.out.println(allLinks.size());
driver.quit();

Console Output:

Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port 1175 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Feb 11, 2020 10:29:05 AM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C 21

Muzzamil
  • 2,823
  • 2
  • 11
  • 23
  • @MansoorShaikh It was workaround as chrome driver binary had a bug when I have posted this answer (chrome driver 89 as I remember) I would recommend to you try latest chrome driver. I hope this bug should be fixed now. – Muzzamil Jun 02 '21 at 14:56
  • In my code there is `except TimeoutException:`. However, in case of `selenium.common.exceptions.TimeoutException: Message: timeout: Timed out receiving message from renderer: xxx` the exception is not caught leading to printing `Traceback (most recent call last):`, `Stacktrace:`, and `Backtrace:` followed by abnormal exit of the Python script. Why? How to correctly catch this exception? – pmor May 22 '23 at 10:56
13

It looks like there was an issue with the newest Chrome release. Without the disable-gpu Chromeoption set, the renderer will occasionally timeout. The workaround until Google fixes this (if they do fix it at all) is to add the --disable-gpu attribute to the ChromeOptions.

EDIT: This reduced the frequency of occurrences, but it is still happening.

Brandon Schabell
  • 1,735
  • 2
  • 10
  • 21
12

v93 broken my code, i tried so many option finally, following code is working fine for me.

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--disable-gpu");
WebDriverManager.chromedriver().forceDownload().setup();
webDriver = new ChromeDriver(chromeOptions);
Jayanth Bala
  • 758
  • 1
  • 5
  • 11
6

In our case, we found the problem was a performance issue because the screenshot taken was huge but it happened because we realized the screenshot resolution of the screenshots created by Chrome was double than the specified in code for calling the chromedriver, for example, if we specified width 1024px and height 2000px in the screenshot, it was creating an image of 2048px width and 4000px height so that is why was taking too much for rendering and the timeout breaks the process, in cases when the process finished (after long wait) it was creating a heavy screenshot images. We found it was an option (problem) of Chrome for supporting retina devices which increase the resolution of the screenshot, so, we forced using a flag to deactivate the option and render the original resolution configured and it works well, taking between 8 seconds to 13 seconds to create the screenshot (depending on the content of the page) and the image size is less than at the begenning. This is the flag into the ChromeOptions object:

options.addArguments("--force-device-scale-factor=1");
highsoftx980
  • 71
  • 2
  • 4
4

First of all the other answers have been of great help and as everyone, I too have been struggling to make the chrome webdriver work, using the endless list of arguments that it requires. Below are some of my observations after breaking my head over this for a while:

The Timeout error is received due to manually setting the timeout of the webdriver. driver.set_page_load_timeout(30) We can skip this line and resolve the error, but then the webdriver would run indefinitely if the website keeps on loading and hence is always recommended to use.

First of all, make sure the chrome driver and chrome are on the stable recent cross-compatible versions. (most common error) Since I use docker for my use-case, I let my code handle to download the latest stable versions of both chrome and chromedriver during docker build, to rule out compatibility issues. Refer here for a simple explanation of the same.

Secondly, the below arguments helped me run the chromedriver as headless without any issues. I'm surprised the arguments aren't well documented anywhere. Found good documentation here

--no-sandbox
window-size=1920,1080
--ignore-certificate-errors
--ignore-ssl-errors
--disable-dev-shm-usage
--disable-gpu")
--log-level=3")
enable-features=NetworkServiceInProcess
disable-features=NetworkService

And thirdly, after the above configurations, the issue I faced was it was working for me in a docker container when run on windows, but failed to run on Linux/Kubernetes. The reason being, for Linux, it requires a PyVirtualDisplay to work. Hence adding this below piece of code before using the webdriver resolved all issues.

from pyvirtualdisplay import Display
display = Display(visible=0, size=(1024, 768)) 
display.start()
Shreyesh Desai
  • 569
  • 4
  • 19
  • +1 specifically for pointing me to the ability to tweak the timeout with `set_page_load_timeout`. I think even if you don't call this there's likely a default, and for many situations the default may simply be too low. – Stephen Jul 26 '21 at 13:17
  • Thanks a lot! After experimenting with 23 different arguments, including the last two you listed here and that I had not seen before, I was finally able run a Python script on a Debian machine in Google Cloud as intended... – Spherical Cowboy Sep 18 '21 at 22:39
3

If your website is https, and having trouble with chromedriver on timedout issue, use

option.addArguments("enable-features=NetworkServiceInProcess")

If the above doesn't work, use

option.addArguments("disable-features=NetworkService") 

instead

Credit goes to https://groups.google.com/forum/#!topic/chromedriver-users/yHuW_Z7tdy0

Bhuvanesh Mani
  • 1,394
  • 14
  • 23
2

I was seeing issues going from Chrome 72 to 73 and was getting the error message:

Timed out receiving message from renderer: 600.000

I was getting the error only when i was running tests on Jenkins (tests were running fine on my local development machine) which i found rather odd.

I tried Firefox and no issues found so this narrowed it down to Chrome. After looking through the Chromium issue tracker i found Issue 946441: Chromedriver: Timed out receiving message from renderer error for Selenium+Chrome+Jenkins(user SYSTEM)

As this was a renderer issue, i tried running tests in headless mode which resolved the issue.

jrc16
  • 97
  • 7
1

I was seeing the Timed out receiving message from renderer: aka Net::ReadTimeout issue 100% of the time in a Cucumber test running in a Jenkins build env after the docker selenium/standalone-chrome image was updated in late Jan 2018. Adding the --disable-gpu attribute to the ChromeOptions did not fix it for me, but adding the --disable-browser-side-navigation option fixed it 100%. I found that recommendation here: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2239#c10

it said there are several workarounds to this issue:

  • A fix is in Chrome v65, which is currently available in beta. This is the best option if you can use beta builds.

  • Add --disable-browser-side-navigation switch to Chrome command line.

  • Use ChromeDriver 2.33, which automatically uses --disable-browser-side-navigation.

dansalmo
  • 11,506
  • 5
  • 58
  • 53
1

I encountered the same issue while triggering execution from Jenkins. I played around a bit and found that only adding the below chrome option makes thing work:

options.addArguments("--no-sandbox");
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Soumya
  • 19
  • 4
1

Sounds silly, but when the loops just doesn't end, try and check your internet connection.

Zoette
  • 1,241
  • 2
  • 18
  • 49
1

Just addon hope this will help someone:If you are coding in python3

You are getting error like Instance of 'Options' has no 'addArguments' memberpylint(no-member) while using options.addArguments("--xxx") then you need to change addArguments to add_arguments
Like: options.add_argument("--xxxx")

Ashu
  • 341
  • 2
  • 5
0

I know the question as about Chromedriver, but for anyone like me who isn't specifically testing on Chrome and just needs a working headless browser in Selenium: switch to Firefox (Geckodriver). I set a single option and forgot all about these Chromedriver bugs and rendering problems:

from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
browser = webdriver.Firefox(options=options)

It just works (tm).

kontextify
  • 478
  • 5
  • 16
0
In order to execute chrome test cases parallel in a headless mode using jenkins 

options.addArguments("--no-sandbox"); 
options.addArguments("--disable-dev-shm-usage"); 
options.addArguments("--aggressive-cache-discard"); 
options.addArguments("--disable-cache"); 
options.addArguments("--disable-application-cache"); 
options.addArguments("--disable-offline-load-stale-cache"); 
options.addArguments("--disk-cache-size=0");
options.addArguments("--headless"); 
options.addArguments("--disable-gpu"); 
options.addArguments("--dns-prefetch-disable"); 
options.addArguments("--no-proxy-server"); 
options.addArguments("--log-level=3"); options.addArguments("--silent"); options.addArguments("--disable-browser-side-navigation"); options.setPageLoadStrategy(PageLoadStrategy.NORMAL); 
options.setProxy(null);
Arkesh
  • 21
  • 2
0

You need to disable the ChromeDriverService loggers.

Add the following method to whichever class is creating the driver,

and make sure call it once before creating any driver instances:

import org.openqa.selenium.chrome.ChromeDriverService;
import java.util.logging.Level;
import java.util.logging.Logger;

public static void disableSeleniumLogs() {    
    System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY, "true");
    Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
}
Hrisimir Dakov
  • 557
  • 3
  • 9
0

You can overcome these timeout error by running Chromedriver executable file in Silent mode

System.setProperty("webdriver.chrome.driver","driver_path");
System.setProperty("webdriver.chrome.silentOutput", "true");
Paolo42
  • 182
  • 1
  • 8
0

I found that in my case, the sporadic failures were because CPU resources would go up and down sporadically on the server which changes the time it takes to render elements or execute JS on a page. So, the ultimate solution for me was to simply increase the timeouts as follows:

// Driver constants and methods
const STD_TIMEOUT = 100000

let setDriverTimeout = async (timeout) => {
  await global.driver.manage().setTimeouts({
    implicit: timeout,
    pageLoad: timeout,
    script: timeout
  })
}

Here, if I use STD_TIMEOUT that is too small, I will get more of the error "timed out receiving message from renderer".

Also, as a side-note, I can trigger this to happen even more frequently by increasing the CPU throttling rate as such:

  global.driver = await new Builder()
    .forBrowser('chrome')
    .setChromeOptions(options)
    .build()

  await driver.sendDevToolsCommand(
    'Emulation.setCPUThrottlingRate', {
      rate: 1800
    }
  );

With a high rate such as 1800, the renderer will timeout very often.

thorie
  • 160
  • 1
  • 7
0

THIS WORKS After googling through many many threads, I finally got the solution to such problems.

While most of the solutions above have pointed out the problem correctly which is arising due to bug in Chrome updates, follow below solution to get it fixed-

  1. Download and use the latest ChromeDriver- compatible with the version of Chrome
  2. Download the latest Selenium Driver from https://www.selenium.dev/ and execute the jar file on your system once.
  3. Run the you code again to see the magic
Chetanya Saxena
  • 133
  • 2
  • 12
0

Seems Like browser is not loading the URL due to network issue or you quited the driver with driver.quit() in previous execution

0

I had the same problem during jenkins job run. The fix which was working for me is to setup proxies in .bash_profile under jenkins user:

sudo su -s /bin/bash jenkins
nano ~/.bash_profile
...your proxy
source ~/.bash_profile
Kateryna
  • 81
  • 7
0

The only tweak that reproduced reliably the Timed out receiving message from renderer error was setting page load timeout too low (in my tests "too low" was lower than 10 seconds when testing slow-loading web pages through distant and overloaded anonymous proxies).

That solved it:

chrome_driver.set_page_load_timeout(PAGE_LOAD_TIMEOUT_SEC)


The default is 300 seconds though (see webdriver docs on Timeouts), so you or others must have probably customized it to a shorter value to cause the problem.

The remaining "magic" settings/tweaks proposed here are not strictly necessary according to my tests.

mirekphd
  • 4,799
  • 3
  • 38
  • 59