C# OpenQA.Selenium.WebDriverException:对远程WebDriver服务器的URL的HTTP请求http://localhost :单击90秒后超时

C# OpenQA.Selenium.WebDriverException:对远程WebDriver服务器的URL的HTTP请求http://localhost :单击90秒后超时,c#,selenium,google-chrome,webdriver,selenium-chromedriver,C#,Selenium,Google Chrome,Webdriver,Selenium Chromedriver,在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 af

在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)
为了解决这个问题,我做了以下工作:

  • 使用“提交”而不是“单击”
  • 创建进程以识别服务器上打开的chrome实例并关闭(杀死PID)
  • 代码试用:

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

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

    您的登录代码是什么样子的?很简单-public void login(){ClearLoginFields();_userNameFieldElement.SendKeys(用户名);_passwordFieldElement.SendKeys(密码);_SigninButtoneElement.Submit();}