首页 > 解决方案 > OpenQA.Selenium.WebDriverException :对远程 WebDriver 服务器的 HTTP 请求 URL http://localhost :点击 90 秒后超时

问题描述

在 TFS 错误上执行自动化脚本时出现以下错误,

错误信息:

OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:59508/session/b655773d161676bad7ab56591cce3cf2/element/1560281f-e8b2-4bd7-a6c7-7eba3a94adc9/click timed out after 90 seconds.
----> System.Net.WebException : The operation has timed out

堆栈跟踪:

at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Click()
at QuotOMatic.Test.UI.Pages.Login.LogIn() in D:\B\2\2\s\QuotOMatic.Test.UI\Pages\Login.cs:line 117
at QuotOMatic.Test.UI.Tests.TC418369_Broker_Authentication_SmokeTest._Login() in D:\B\2\2\s\QuotOMatic.Test.UI\Tests\TC418369_Broker_Authentication_SmokeTest.cs:line 29
--WebException
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)

我做了以下工作来解决这个问题:

  1. 使用“提交”而不是“点击”
  2. 创建进程以识别服务器上打开的 chrome 实例并关闭(杀死 PID)它们
  3. 代码试验:

    ChromeOptions  options = new ChromeOptions();
    options.AddArgument("no-sandbox");
    _driver = new ChromeDriver(chromeService, options, TimeSpan.FromSeconds(120));
    

你能指导我解决这个问题吗???

标签: c#seleniumgoogle-chromewebdriverselenium-chromedriver

解决方案


推荐阅读