I have a Visual Studio 2008 Team System C# solution running on my Windows 7 64bit box, and it has about 200 Selenium tests.
Until an hour ago most of the tests were okay, but suddenly none of the tests will run. They all give the same 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:4444.
I'm using selenium-server-standalone-2.45.0, installed in ...\Program Files (x86)\selenium-remote-control-2.45.0
This has happened out of the blue, and I can't fathom out what might have changed. The code where the error is generated (this has been unchanged for years and usually works quite reliably) is:
public static ISelenium CreateDefaultSelenium()
{
string browser = ConfigurationManager.AppSettings["UnitTestBrowserString"];
if (browser == null)
browser = "*iexplore";
ISelenium selenium = new DefaultSelenium("localhost", 4444, browser, "http://localhost/");
return selenium;
}
public static void Start(this ISelenium selenium, int tries)
{
// Start the browser with a new Selenium session. Catch any WebException (eg socket refused) and retry a few times.
bool started;
int tryCount = 0;
do
{
tryCount++;
try
{
selenium.Start(); //<--this fails with the WebException
started = true;
}
catch (System.Net.WebException)
{
started = false;
if (tryCount >= tries)
throw;
}
} while (!started);
}
//start selenium at the beginning of each test:
ISelenium selenium = CreateDefaultSelenium();
selenium.Start(5);
and it throws a WebException with the error message I copied above.
I've ensured my local Windows firewall has port 4444 open for inwards TCP and UDP (it isn't usually), but that hasn't cured the problem. If I run the web application myself, it works fine so IIS is okay, although VS is using its own webserver. Rebooting has made no improvement.
Can anyone suggest what might have changed to cause this? I am at a loss as to where to turn next.
TIA