OpenQA.Selenium.WebDriverException:'无法在http://localhost:60623/上启动驱动程序服务 [英] OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:60623/'

查看:425
本文介绍了OpenQA.Selenium.WebDriverException:'无法在http://localhost:60623/上启动驱动程序服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码在过去运行良好.几天后,我尝试再次运行它,但是会引发此类错误.

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));

}

错误:

OpenQA.Selenium.WebDriverException:'无法在 http://localhost:60623/上启动驱动程序服务

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

推荐答案

服务启动时,唯一执行的操作是带有驱动程序服务的进程以及对该服务的api调用.
可能出现的问题可能是:

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
      • 代理设置(添加NO_PROXY环境变量(不包括localhost可能有帮助)
      • 防火墙设置
      • 端口已使用
      • proxy settings (adding NO_PROXY environment variable excluding localhost might help)
      • firewall settings
      • port already used

      这篇关于OpenQA.Selenium.WebDriverException:'无法在http://localhost:60623/上启动驱动程序服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆