在C#中运行HtmlUnit? [英] Running HtmlUnit in C#?
问题描述
我正在尝试使用C#中的Selenium WebDriver运行HtmlUnit.
I'm trying to run HtmlUnit using Selenium WebDriver in C#.
当我运行以下代码(据我所知,应启动HtmlUnit网络驱动程序):
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);
我得到了例外:
意外错误. System.Net.WebException:无法连接到 远程服务器---> System.Net.Sockets.SocketException:无连接 因为目标机器主动拒绝,所以可以进行 127.0.0.1:4444
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
就我而言,我需要运行HtmlUnit服务器. 如果有人可以帮助我,那么我一定会非常感激!!!
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!!!!
推荐答案
您的命令尝试连接到Selenium节点,但不会启动它.
Your command tries to connect to a Selenium node and doesn't start it.
这篇关于在C#中运行HtmlUnit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!