OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:60623/'

允我心安 提交于 2020-05-14 07:15:10

问题


Following code worked well in the past. After some days, I try to run it again but it throws such error.

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: 'Cannot start the driver service on http://localhost:60623/'


回答1:


When the service start the only things executed are a process with the driver service and an api call to that service.
The problems that can rise could be:

  • you can't execute the process, because the executable is not reachable
    • executable not there
    • wrong permissions
  • some configurations are preventing you from executing successfully the api call and reach http://localhost:60623/
    • proxy settings (adding NO_PROXY environment variable excluding localhost might help)
    • firewall settings
    • port already used


来源:https://stackoverflow.com/questions/56712777/openqa-selenium-webdriverexception-cannot-start-the-driver-service-on-http-l

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