无法在Selenium中启动Chrome驱动程序 [英] Can't launch chrome driver in Selenium

查看:184
本文介绍了无法在Selenium中启动Chrome驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是能够在本地启动chromedriver服务器,但是后来我尝试远程执行此操作,此后我无法启动它.我重新安装了chrome和chrome驱动程序,但似乎没有任何解决方法.即使我给出了驱动程序的路径,它也不会启动.

I was always able to launch chromedriver server locally but then I tried to do this remotely and since then I am unable to launch it. I reinstalled chrome as well the chrome driver but nothing seems to fix this. Even when I give the path of my driver it won't launch.

using OpenQA.Selenium;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Chrome;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium.Safari;
using OpenQA.Selenium.Interactions;

namespace TestWebDriver
{
    class Program
    {
        static void Main(string[] args)
        {
            var driver = new ChromeDriver(@"C:\Users\laurens.putseys\Documents\Visual Studio 2015\Projects\TestWebDriver\packages\Selenium.WebDriver.ChromeDriver.2.21.0.0\driver\");
            driver.Url = "http://google.be";
            Console.ReadLine();
            driver.Quit();
        }
    }
}

我得到的错误如下:

An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll

Additional information: unknown error: chrome failed to start

  (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64)

它是在我尝试过之后开始的:

It started after I tried this:

System.Environment.SetEnvironmentVariable("webdriver.chrome.driver",@"/path/to/where/you/ve/put/chromedriver.exe"

现在我也无法启动本地.启动IE和Firefox本地工作不会出现任何问题.有任何想法吗?提前致谢!

Now I cannot launch the local either. Launching IE and Firefox local work without any problems. Any ideas? Thanks in advance!

推荐答案

尝试下载驱动程序并将其路径提供给承包商-

try downloading the driver and give its path to contractor - LINK

driver = new ChromeDriver(DRIVER_PATH);

这篇关于无法在Selenium中启动Chrome驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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