我在 VS2010 测试项目中有一个简单的 Selenium 测试,如下所示。
[TestMethod]
public void MyTestInIE8()
{
IWebDriver driver = new InternetExplorerDriver();
try
{
driver.Navigate().GoToUrl("http://localhost/MyMVC/ABC/DoStuff");
driver.FindElement((By.Id("Name"))).SendKeys("John");
//... run rest of the test
}
finally
{
driver.Quit();
}
}
这在本地服务器上运行良好。但是在构建服务器上它失败并显示以下消息。
...抛出异常:OpenQA.Selenium.WebDriverException:服务器没有响应 url http://localhost:4444/session/5e5e9b7a-e05c-40d8-9a20-9cab138b2b87 .
问题似乎是在 finally 子句中调用 Quit() 方法。我试图传入一个已知的端口号,即 InternetExplorerDriver(8080),但没有任何区别。 Firefox 驱动程序在本地和构建服务器上运行良好。我发现有人报告了类似的问题,但没有找到有效的解决方案。 http://groups.google.com/group/webdriver/msg/4347971da4d96e97
这是我的配置。
Windows 7 专业版 SP1,64 位。
Webdriver - selenium-dotnet-2.0b2。
IE8。
我的构建服务器是带有 IE8 的 Windows Server2008 R2 Standard。
谢谢。
最佳答案
Internet Explorer 驱动程序需要对 IE 进行一些配置,如 project wiki 中所述。 .您需要确保在构建服务器上正确配置了浏览器。
Selenium 项目最近已更新,以在 IE 驱动程序未正确配置的情况下引发更有用的错误。更新到 2.0rc2会给你这个更有用的错误。
关于internet-explorer - Selenium 测试在构建服务器上失败,错误为 "No response from server",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5271473/