问题
I'm trying to run HtmlUnit using Selenium WebDriver in C#.
When I run the following code (which as I understand it should start the HtmlUnit webdriver):
var caps = DesiredCapabilities.HtmlUnit();
IWebDriver driver = new RemoteWebDriver(caps);
I get the exception:
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
As far as I'm concerned I need to have the HtmlUnit server running. If anyone could help me out then I'd greatly appreciate it for sure!!!!
回答1:
Your command tries to connect to a Selenium node and doesn't start it.
来源:https://stackoverflow.com/questions/29456504/running-htmlunit-in-c