Saturday, August 25, 2018

Timed out receiving message from renderer in selenium

This post explains how to handle Timed out receiving message from renderer issue with the help of selenium webdriver.
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 3 to 4 mins to load page, in that case you will see TimeoutException exception in your console.
Jul 06, 2018 4:07:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
[1530864721.448][SEVERE]: Timed out receiving message from renderer: 298.565
[1530864721.449][SEVERE]: Timed out receiving message from renderer: -0.004
[1530864721.469][SEVERE]: Timed out receiving message from renderer: -0.024



Solution to Overcome/Solve Timed out receiving message from renderer issue  :

When Page Loading takes too much time and you need to stop downloading additional subresources (images, css, js etc) you can change the  pageLoadStrategy through the webdriver.

As of this writing, pageLoadStrategy supports the following values :
Page load strategy for Chrome driver (Updated till Selenium v3.12.0)
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.

Example :
System.setProperty("webdriver.chrome.driver","E:\\selenium\\chromedriver_2.41\\chromedriver.exe");
//mention the below chrome option to solve timeout exception issue
ChromeOptions options = new ChromeOptions();
options.setPageLoadStrategy(PageLoadStrategy.NONE);
// Instantiate the chrome driver
driver = new ChromeDriver(options);

Hope this example solve your timeout exception issue in selenium. In case of any issues, please do comment in comment box below.



9 comments:

  1. While executing testcase getting
    [1540801449.733][SEVERE]: Timed out receiving message from renderer: 600.000
    [1540801749.734][SEVERE]: Timed out receiving message from renderer: 300.000
    [1540802349.734][SEVERE]: Timed out receiving message from renderer: 600.000
    [1540802349.734][SEVERE]: Timed out receiving message from renderer: -600.002
    [1540802649.739][SEVERE]: Timed out receiving message from renderer: 300.000
    [1540803249.739][SEVERE]: Timed out receiving message from renderer: 600.000
    [1540803249.740][SEVERE]: Timed out receiving message from renderer: -600.001


    ChromeDriver : 2.43.600210
    Chrome Version : 70.0.3538.77

    ReplyDelete
    Replies
    1. apply below line code in selenium script :
      ChromeOptions options = new ChromeOptions();
      options.setPageLoadStrategy(PageLoadStrategy.NONE);
      // Instantiate the chrome driver
      driver = new ChromeDriver(options);

      Delete
  2. Tho PageLoadStrategy.EAGER is not supported for now.

    Great thanks for this article, helped a lot.

    ReplyDelete
  3. how to handle the same issue in internet explorer

    ReplyDelete
  4. HI,

    Thanks for your solution but it is not working in my case. When I am running it on my machine(without jenkins). chrome is initiated successfully and automation scripts are executed but when I do the same from jenkins. It keeps on giving below error:
    [1554447408.210][SEVERE]: Timed out receiving message from renderer: 600.000

    I have tried your solution also but not helping.
    Chrome browser version- Version 73.0.3683.86 (Official Build) (64-bit)
    chrome driver exe: 73(recent stable version)
    Selenium: 3.12

    Can you pls help

    ReplyDelete
  5. Iam facing the same issue, Did you get the solution?

    ReplyDelete
  6. Did we get solution for this issue?

    ReplyDelete