简体   繁体   中英

An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll Additional information: Unexpected error. Unknown error

I am creating a very simple console application to essentially show that I have setup the web driver correctly before moving on to more advanced applications. I am using C# with the selenium language bindings and Microsoft Edge.

I have version 3.0 of the Selenium Web Driver C# language bindings listed here .

I have Microsoft Edge version 38.14393.0.0 with Microsoft EdgeHTML 14.14393

I am on Windows 10 Anniversary edition (14393 Build 1607) and have the corresponding version of the Micrsoft Web Driver from here .

I am testing in Visual Studio Enterprise 2015

When I try to initialize the EdgeDriver I get this error:

An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll

Additional information: Unexpected error. Unknown error

It is throwing the exception on this line of code:

  static IWebDriver Edge = new EdgeDriver();

I would like ways of troubleshooting this or if I have some kind of version mismatch I would like to know what I need to get this working.

When I removed the static modifier from the WebDriver initialization it suddenly started working.

IWebDriver Edge = new EdgeDriver();

While I did not see any documentation that says we can't use a static instance, apparently we cannot.

The same completely nondescript error occurs when there is already an instance of MicrosoftWebDriver.exe running.

Solution: Kill all corresponding instances first:

foreach (var process in System.Diagnostics.Process.GetProcessesByName("MicrosoftWebDriver"))
{
    process.Kill();
}

(This happened to me using Selenium.WebDriver 3.141.0)

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