当我使用 c# Nunit 使用以下配置 Protractor.net 运行测试时引发以下异常
1. "NUnit" version="3.11.0"
2. "NUnit3TestAdapter" version="3.12.0"
3. "Protractor" version="0.12.0"
4. "Selenium.WebDriver" version="3.141.0"
5. "Selenium.WebDriver.ChromeDriver" version="2.36.0"
6. Chromebrowser Version : 65.0.3325.162
angular.version {full:“1.6.9”,major:1,minor:6,dot:9,codeName:“fiery-basilisk”}
下面是我用于测试的示例代码,它在 NgBy.Repeater 处失败
private IWebDriver driver;
driver = new ChromeDriver();
driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(60);
public void uitest()
{
try {
ngDriver.Navigate().GoToUrl("");
ngDriver.FindElement(By.Id("userNameInput")).SendKeys("");
ngDriver.FindElement(By.Id("passwordInput")).SendKeys("");
ngDriver.FindElement(By.Id("submitButton")).Click();
string text=ngDriver.FindElements(NgBy.Repeater(""))[0].Text;
Assert.AreEqual("Dashboard", text);
}catch(Exception e)
{
Console.WriteLine("Exception :"+e.ToString());
Assert.True(false);
}
driver.Quit();
}
例外 :
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:61649/session/f5f68e3d39a9e0e5adee0c5d76acd9d1/execute_async timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out
at System.Net.HttpWebRequest.GetResponse()
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
--- End of inner exception stack trace ---
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.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteAsyncScript(String script, Object[] args)
at Protractor.NgWebDriver.WaitForAngular() in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 359
at Protractor.NgWebDriver.FindElements(By by) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 299