1

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.

2 Answers 2

3

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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