以下代码在过去效果很好。几天后,我尝试再次运行它,但它抛出了这样的错误。
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
public static ChromeDriver driver;
protected void initDriver(string userDataPath) {
var driverService = ChromeDriverService.CreateDefaultService(AppDomain.CurrentDomain.BaseDirectory);
ChromeOptions options = new ChromeOptions();
driverService.HideCommandPromptWindow = true;
//options.AddArguments("--headless");
options.AddArguments("--no-sandbox");
options.AddArguments("disable-extensions");
options.AddArguments("--start-minimized");
driver = new ChromeDriver(driverService, options, TimeSpan.FromSeconds(10*60));
}
Error:
OpenQA.Selenium.WebDriverException:'无法启动驱动程序服务http://本地主机:60623/'
当服务启动时,执行的唯一事情是带有驱动程序服务的进程和对该服务的 api 调用。
可能出现的问题可能是:
- you can't execute the process, because the executable is not reachable
- some configurations are preventing you from executing successfully the api call and reach http://localhost:60623/
- 代理设置(添加
NO_PROXY
环境变量排除localhost
可能有帮助)
- 防火墙设置
- 端口已使用
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)