Running HtmlUnit in C#?

家住魔仙堡 提交于 2019-12-11 10:40:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!