I'm porting some Selenium JUnit tests to a .NET project (tests for a MVC project).
I have following line in Java:
WebDriver driver = new HtmlUnitDriver();
I ported it to .NET like this:
IWebDriver driver = new RemoteWebDriver(DesiredCapabilities.HtmlUnit());
In Java this works perfectly to test a Spring application, but in .NET it throws an Exception:
Test method TDD.Tests.Acceptatie.TestLoginScreen.LoginScreenTest threw exception:
OpenQA.Selenium.WebDriverException: Unexpected error.
System.Net.WebException: Can't connect to remote server --->
System.Net.Sockets.SocketException:
Can't connect because target computer actively refused the connection 127.0.0.1:4444
NOTE: the error message is translated from dutch so probably not the exact message in english.
I have added the Selenium.Webdriver NuGet package. The project structure is the following:
- MVC-project (TDD)
- NUnit project (TDD.Tests) with a ref to TDD
The MVC project is configured to run on localhost:8080 and I also tried to set the webdriver to that ip:
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:8080"), DesiredCapabilities.HtmlUnit());
I also tried to use the loopback address instead of 'localhost'.
Anyone knows what could cause this problem and how to fix this?
Thanks in advance!