13

I am new to selenium, I'm facing "Time out receiving message from the renderer" in chrome browser while running test with selenium 2.41 and chrome 2.9x. I have tried many tests to reproduce the issue, but it occurs inconsistently. Is there any specific reasons for this issue?.

  • The code for a small test case might help. – user246 Jun 24 '14 at 13:39
  • 1
    that error typically means there is a version mismatch between chrome and chromedriver. – Corey Goldberg Mar 7 '18 at 14:28
  • One of the issue is, after login, chrome has opened a dialog asking for proxy credentials. Since this dialog not visible in failure screenshot, so able to capture the issue after manually checking from the node machine. – Vignesh Nov 29 '18 at 15:07
7

It looks like this issue has been logged as a bug for Selenium but has not yet been fixed: Issue 402: webdriver hangs on page load and does not give control back for script execution

They are looking for a specific repro, maybe you could help them out by posting your specific repro?

One person reported that removing any driver timeout options from their code solved the problem:

//driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS);
//driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
//driver.manage().timeouts().setScriptTimeout(60, TimeUnit.SECONDS);
  • hell yeah, this answered helped me as well; – eugene.polschikov Jan 3 '17 at 10:58
  • worked w/o any timeout options: String webDriverURL = "http://" + environmentData.getHubIP() + ":" + environmentData.getHubPort() + "/wd/hub"; driver = new RemoteWebDriver(new URL(webDriverURL), capability); // driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); // driver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS); driver.manage().window().setSize(new Dimension(1920, 1080)); – eugene.polschikov Jan 3 '17 at 11:00
3

So I've solved this, but my solution is an awful hack. The only thing it has going for it is that it has worked, at least for us. The code and explanation are here:

http://testautomationarchitecture.blogspot.com/2016/10/python-selenium-and-dreaded-timed-out.html

  • 4
    Your blog post is a good one, but could you please add the key points of your solution to your answer here. We much prefer to have the important aspects of a solution in the body of the answer with references to more details. – Kate Paulk Oct 12 '16 at 19:39
3

I am not saying this is the solution but I want to share my experience after investigating a day on this. The problem with our site was actually because of the time it took for a third party to load a page source when using Google tagging (GTM).This can be overlooked by adding a chrome extension like Ghostery and block all the tags. Or better you can ask your developers to turn off tagging on pre-prod. With the former approach you can load the chrome profile with Ghostery as below.

DesiredCapabilities capabilitiesChrome = DesiredCapabilities.chrome();
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--always-authorize-plugins");
        options.addArguments("load-extension=C:/Users/hemanand.rajamani/AppData/Local/Google/Chrome/User Data/Default/Extensions/mlomiejdfkolichcflejclcbmpeaniij/7.1.0.49_0");
        options.addArguments("user-data-dir=C:/Users/hemanand.rajamani/AppData/Local/Google/Chrome/User Data/Default");
        capabilitiesChrome.setCapability(ChromeOptions.CAPABILITY,options);
        try {
            desiredBrowser = new RemoteWebDriver(new URL("http://" + hubHost + ":" + hubPort + "/wd/hub"),
                    capabilitiesChrome);

        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

Hope this helps someone.

2

Thanks for your responses finally I solved it cutting out some plugins and blocked some third party ads before starting the tests.

Solution 1: There are some plugins like flash player which may hangs the browser inconsistently waiting for some resource during test run, try disabling such plugins while starting the test using the chrome switches. http://peter.sh/experiments/chromium-command-line-switches/

Solution 2: The browser might hang waiting for some third party ads. Try disabling ads using some ad blocker extension or block the url pattern using the custom proxy configuration.

For inconsistent browser hangs, Try to find which process hangs the browser. 1.Unlike firefox chrome creates separate process for browser, tab, extension and plugins. 2.When the browser hangs check is there any new process(shift+Esc) like Web Worker:blob appended with an third party url, then follow #2 3.or else if there are more separate process opened for plugins try #1

1

I had been dealing with this problem for 6 months or so and every time I was hoping it would be fixed in the next update but it didn't.

So for sake of saving time of others who have run into the same or similar problem, the issue is that for some reasons the page has not loaded completely and it will eventually timeout.

I firstly tried running a code in future using the Timers but that didn't help much either.

The best and WORKING solution I found was to create my own extension that all it does is to stop the page:

manifest.json:

{
  "manifest_version": 2,
  "name": "Amir's Extension",
  "version": "1.0.0",
  "content_scripts": [
    {
      "all_frames": true,
      "matches": ["*://*/*"],
      "js": ["content.js"],
      "run_at": "document_start"
    }
  ]
}

and in the content.js file:

setTimeout(() => {window.stop()}, 10000);
setInterval(() => {window.stop()}, 20000);

So I also needed to enable it:

Path currentRelativePath = Paths.get("");
String s = currentRelativePath.toAbsolutePath().toString();
chromeOpt.addArguments("--load-extension="+s+"/stopper");

And yay! I haven't had a single time-out issue yet!

0

driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS); driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);

in my code, above 2 lines used and I comment the second line my application is working fine.

//driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);

  • 1
    This is either a comment on the original question or a new question - I'm not sure which, but it isn't appropriate as an answer. – Kate Paulk Jun 23 '15 at 11:05
  • I don't see this as an answer to the question being asked. Can you please explain what you are trying to convey with this content as an answer? – Milin Patel Jul 10 '15 at 17:08
0

I'll share my case:

I had this issue with my Django selenium tests (django==1.7.12 and selenium==2.53.1) with ChromeDriver 2.21.371459 and Google Chrome 48.0.2564.116.

I was able to isolate the issue. In my case it was happening only for pages referencing a static file (an image in a HTML tag for instance http://cdn.local.myproject.net/static/myimage.png) on my custom local cdn domain. The issue was not present if I used a relative path "/static/myimage.png" or localhost "http://127.0.0.1/static/myimage.png so I figured it was a DNS problem.

I was able to bypass the problem by using the --dns-prefetch-disable option of chrome.

Example in Python:

from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument('--dns-prefetch-disable')
driver = Chrome(chrome_options=options)

I don't know if this is the general case but hopefully it can help some of you.

0

try-catch this timeout exception:

    try{
     // your code with timeout exception
    } catch {
      case e: Throwable => {

        println(Console.RED + "  Alert-окно! " + Console.RESET)

        // println(Console.MAGENTA_B + "press..." + Console.RESET); Console.in.readLine()

        try {
          println("  13 alert. close trying ")
          println("e.getCause: " + e.getCause)
          remote20.switchTo().alert().accept()
          remote20.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS)
          remote20.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS)
        } catch {
          case e: Throwable => {
            println("  13 alert. no alert-window")
          }
        }
        // println(Console.MAGENTA_B + "press..." + Console.RESET); Console.in.readLine()

      }
    }
0

It causes because page took long time to load , you need add additional line to your chromedriver option. Please refer the below link for more information : Timed out receiving message from renderer in selenium

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.