构建服务器上的Selenium测试失败,并且“没有来自服务器的响应”错误 [英] Selenium test fails on build server with "No response from server" error

查看:325
本文介绍了构建服务器上的Selenium测试失败,并且“没有来自服务器的响应”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在VS2010测试项目中有一个简单的Selenium测试,如下所示。

I have a simple Selenium test within VS2010 test project as follows.

[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

This runs fine on the local server. However on the build server it fails with the following message. ...threw exception: OpenQA.Selenium.WebDriverException: No response from server for url http://localhost:4444/session/5e5e9b7a-e05c-40d8-9a20-9cab138b2b87.

问题似乎是调用Quit finally子句中的()方法。我试图传入一个已知的端口号,即InternetExplorerDriver(8080),但它没有任何区别。 Firefox驱动程序在本地和构建服务器上运行良好。我发现有人报告了类似的问题,但没有找到有效的解决方案。 http://groups.google.com/group/webdriver/msg/4347971da4d96e97

The problem seems to be calling the Quit() method in the finally clause. I tried to pass in a known port number, i.e. InternetExplorerDriver(8080), but it made no difference. Firefox driver runs fine both locally and on the build server. I found someone reporting similar issue but did not find a working solution. http://groups.google.com/group/webdriver/msg/4347971da4d96e97

这是我的配置。
Windows 7专业版SP1,64位。

Webdriver - selenium-dotnet-2.0b2。

IE8。

Here is my config. Windows 7 professional SP1, 64 bit.
Webdriver - selenium-dotnet-2.0b2.
IE8.

我的构建服务器是带有IE8的Windows Server2008 R2 Standard。

谢谢。

My build server is Windows Server2008 R2 Standard with IE8.
Thanks.

推荐答案

Internet Explorer驱动程序需要一些IE配置,如项目维基中所述。您需要确保在构建服务器上正确配置了浏览器。

The Internet Explorer driver requires some configuration of IE as documented in the project wiki. You will need to make sure that the browser is configured properly on your build server.

Selenium项目最近已更新,以便在以下情况下抛出更有用的错误IE驱动程序配置不正确。更新到 2.0rc2 将为您提供更有用的错误。

The Selenium project has been updated recently to throw a more useful error in the case where the IE driver isn't configured properly. Updating to 2.0rc2 will give you this more useful error.

这篇关于构建服务器上的Selenium测试失败,并且“没有来自服务器的响应”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆