更新时间:2023-09-01 11:12:10
如果尝试在本地主机上运行Selenium2,则无需使用RemoveWebDriver()和Selenium Server-您可以使用以下代码:
If you are attempting to run Selenium2 on localhost, you don't need to use RemoveWebDriver() and Selenium Server - You can use the following:
WebDriver driver = new ChromeDriver();
与使用RemoveWebDriver相比,我发现以这种方式在本地运行的问题更少,如果出现问题,您应该会找到更多可用的信息.
I have found less issues running locally in this way than when using RemoveWebDriver, and you should find you get more information readily available if there is a problem.
或者,您也可以按照 http://blog.stevensanderson.com/2010/03/30/using-htmlunit-on-net-for-headless-browser-automation/