简体   繁体   中英

Can't launch chrome driver in Selenium

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

The error I get is the following:

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"

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

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

driver = new ChromeDriver(DRIVER_PATH);

By the version number ( 2.21.371459 ) you can tell that the ChromeDriver executable has been launched by your remote Selenium server. But the ChromeDriver was obviously unable to launch the Chrome browser. Is it installed on the server? Can you launch is manually? Can you watch the remote server on a screen and see what happens? Are there any error message boxes displayed by Chrome?

Maybe uninstalling and re-installing Chrome could help!

I had the same problem. I had the browser set to always run under the administrator. So I started Visual Studio as an administrator and the problem was solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM