Selenium Timed out receiving message from renderer

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.


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-infobars"); //https://stackoverflow.com/a/43840128/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);

Sources:

  • https://www.skptricks.com/2018/08/timed-out-receiving-message-from-renderer-selenium.html
  • https://stackoverflow.com/a/26283818/1689770
  • https://stackoverflow.com/a/43840128/1689770
  • https://stackoverflow.com/a/50725918/1689770
  • https://stackoverflow.com/a/43840128/1689770
  • https://stackoverflow.com/a/50725918/1689770
  • https://stackoverflow.com/a/49123152/1689770
  • how to solve Selenium ChromeDriver Timed out receiving message from renderer exception

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

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.


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