Selenium WebDriver tests do not work with System.Net.WebException Cannot connect

I am working on a set of Selenium WebDriver tests (not Selenium RC and not using Selenium-Server) that run when the command line is called in MSTest. I broke them into test classes for each browser that we plan to test (Chrome, Firefox and IE9 at the moment), and each test class has a launch method that logs into the system under test and then performs a request and the TearDown method, which closes the browser using WebDriver.Quit ().

On my development machine, everything is very complicated, but on our build machine the initialization / start method of the class works fine and registers on the site, but as soon as the first actual test starts, the test runner closes with an error message:

OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:59982

it is obvious that the port changes depending on which browser is being tested; when I run the whole package, I get errors on different ports for tests for IE, Firefox and Chrome - two errors for each browser (since there are currently two tests for each browser in the set)

The Windows firewall is disabled for the build machine, and checking netstat before running the tests shows that the port is not in use; if I debug the tests and stop after running the launch code, but before running the test, of course, the port is used. 127.0.0.1 and localhost are the same.

I get the same error, regardless of whether I call the test through the command line, run / debug it from Visual Studio using the VS testing tools or run a console application that calls MSTest via Process.Start (), an exception is thrown for the first call FindElement ().

, , dev-?

+2
2

, Teardown finally try/catch, , , . WebDriver, , , WebDriver.

, " " dev, , , .

+3

Visual Studio , . 59982.

, - , .

- . , .

0

All Articles