internet-explorer - Selenium 测试在构建服务器上失败,错误为 "No response from server"

标签 internet-explorer selenium webdriver

我在 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/

相关文章:

JQuery Mobile 导致 Internet Explorer 窗口在加载时发送到后台

python - 当父级位于隐式命名空间中时,BeautifulSoup 会删除子级

java - 以编程方式将第二个 Selenium Grid 节点作为 Grid 进程中的另一个进程生成时出现 ParameterException

python - python 中的 Selenium webdriver : Re-using same web browser across testcases

html - 我不希望 IE 和 Chrome 扩展我的按钮以适应所有文本

css - 在 ie 上调试 css 的最佳方法是什么?

javascript - 为什么这个 JavaScript 广告只有在 <iframe> 中加载时才会被裁剪?

python - 为什么我会收到 ElementClickInterceptedException 错误?

使用 cucumber-junit 和 Java 通过步骤定义文件执行 cucumber 功能文件时出现 java.lang.NullPointerException

java - Selenium WebDriver 匹配相似的 xpath