Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I clearly missed a step trying to get HtmlUnit driver working with my app. I am getting the following exception.

OpenQA.Selenium.WebDriverException was unhandled HResult=-2146233088 Message=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:4444

I am invoking the HtmlUnit driver with the follwing:

IWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"),
                                        DesiredCapabilities.HtmlUnit());

I suspect I need to either use a different Uri or configure something else on my machine. I am running this on Windows 7 Pro x64 bit. Is there something I should be doing with the selenium-server-standalone-2.33.0.jar file?

As a note things are working find with both the IE and Chrome web drivers. I am just experimenting with this as a solutions to see if it is faster.

share|improve this question

2 Answers 2

"Target machine Actively refused it" means that the host sent a reset instead of ack when you tried to connect. There is no problem with your code . Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that port, this may be because it is not running at all or because it is listening on a different port.

once you start the program try netstat -anb at command prompt (requires admin privileges) to verify that it is running and listening on the expected port.

for additional reference you can refer here

share|improve this answer
up vote 1 down vote accepted

The issue I had is that the HtmlUnit driver requires works a bit differently than the FireFox, Chrome or InternetExplorerDriver. Those drivers will get started by the application that is calling them. For this I actually had to start the stand alone server on my box. This was accomplished simply by navigating to the directory that contains the stand alone server jar and starting it. So for me this meant I had this: c:\Program Files (x86)\Selenium\Drivers>java -jar selenium-server-standalone-2.33.0.jar

Then it was simply a matter of ensuring that the Uri I was using matches that shown in console window for the stand alone server for RemoteWebDriver instances.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.