Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

selenium - Cannot get automation extension from timeout: Timed out receiving message from renderer

Using Selenium Webdriver (C#) I'm getting the next error from time to time:

System.InvalidOperationException : unknown error: cannot get automation extension from timeout: Timed out receiving message from renderer: -3.959 (Session info: chrome=37.0.2062.120) (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.2 x86_64)

The way in which this mistake appears:

OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in c:ProjectswebdriverdotnetsrcwebdriverRemoteRemoteWebDriver.cs:line 1048 at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:ProjectswebdriverdotnetsrcwebdriverRemoteRemoteWebDriver.cs:line 865 at AutomatedTests.DriverCover..ctor(IWebDriver driver)

So, it's happening in the next piece of code:

 public class DriverCover
 {
        public DriverCover(IWebDriver driver)
        {
            _driver = driver;

            _driver.Manage().Window.Maximize(); //There is my mistake
        }

        private readonly IWebDriver _driver;
 }

I use this class as a base class of PageObject classes where I use PageFactory to initialize elements of web pages.

I have chromedriver v.2.10 and Google Chrome v. 37.0.2062.120 m

In addition: at the same line I got another error:

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:62407/session/021e05cd4c89abedb2abc77342b3bd7c/window/current/maximize timed out after 60 seconds. ----> System.Net.WebException : The operation has timed outat OpenQA.Selenium.Remote.HttpCommandExecutor.CreateResponse(WebRequest request) in c:ProjectswebdriverdotnetsrcwebdriverRemoteHttpCommandExecutor.cs:line 152 at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) in c:ProjectswebdriverdotnetsrcwebdriverRemoteDriverServiceCommandExecutor.cs:line 73 at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:ProjectswebdriverdotnetsrcwebdriverRemoteRemoteWebDriver.cs:line 852 at AutomatedTests.DriverCover..ctor(IWebDriver driver)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

We were seeing something similar with Chrome and the issue came down to the way we were maximizing the browser before running the tests.

We switched from this:

Driver.Manage().Window.Maximize();

To this (for Chrome only):

if (typeof(TWebDriver) == typeof(ChromeDriver))
{
    var options = new ChromeOptions();
    options.AddArgument("start-maximized");

    driver = new ChromeDriver(driverPath, options);
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...