Selenium test does not work on build server with "No response from server" error

I have a simple Selenium test in 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(); } } 

This works fine on the local server. However, on the build server, it does not work with the following message. ... threw an exception: OpenQA.Selenium.WebDriverException: server response for URL http: // localhost: 4444 / session / 5e5e9b7a-e05c-40d8-9a20-9cab138b2b87 .

The problem seems to be calling the Quit () method in the finally clause. I tried to pass a known port number, i.e. InternetExplorerDriver (8080), but that didn't make any difference. The Firefox driver works great both locally and on the build server. I found that someone was reporting a similar problem, but could not find a working solution. http://groups.google.com/group/webdriver/msg/4347971da4d96e97

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

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

+4
source share
2 answers

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

The Selenium project has recently been updated to make a more useful error in case of incorrect IE driver settings. The 2.0rc2 update will give you this more useful bug.

+5
source

I had this problem, and the solution I found was to wait a bit after using the FindElement() method before acting on the element.

Something like that:

 var element = driver.FindElement(By.Id("Name")) Thread.Sleep(200); element.SendKeys("John"); 

There are apparently some race conditions caused by the driver. Or, what I think is all the same.

+3
source

Source: https://habr.com/ru/post/1343300/


All Articles