gpt4 book ai didi

selenium - 无法从超时 : Timed out receiving message from renderer 获得自动化扩展

转载 作者:行者123 更新时间:2023-12-03 23:28:19 29 4
gpt4 key购买 nike

使用 Selenium Webdriver (C#) 我不时收到下一个错误:

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)



这个错误出现的方式:

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



所以,它发生在下一段代码中:
 public class DriverCover
{
public DriverCover(IWebDriver driver)
{
_driver = driver;

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

private readonly IWebDriver _driver;
}

我使用这个类作为 PageObject 类的基类,我使用 PageFactory 来初始化网页的元素。

我有 chromedriver v.2.10
和 Google Chrome v. 37.0.2062.120 m

另外:在同一行我得到了另一个错误:

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:\Projects\webdriver\dotnet\src\webdriver\Remote\HttpCommandExecutor.cs:line 152 at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\DriverServiceCommandExecutor.cs:line 73 at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\webdriver\dotnet\src\webdriver\Remote\RemoteWebDriver.cs:line 852 at AutomatedTests.DriverCover..ctor(IWebDriver driver)

最佳答案

我们在 Chrome 中看到了类似的东西,问题归结为我们在运行测试之前最大化浏览器的方式。

我们从这里切换:

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

为此(仅适用于 Chrome):
if (typeof(TWebDriver) == typeof(ChromeDriver))
{
var options = new ChromeOptions();
options.AddArgument("start-maximized");

driver = new ChromeDriver(driverPath, options);
}

关于selenium - 无法从超时 : Timed out receiving message from renderer 获得自动化扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25890027/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com