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

二次信任 提交于 2020-06-29 11:20:47

问题


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.


回答1:


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.




回答2:


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)



来源:https://stackoverflow.com/questions/40247162/an-unhandled-exception-of-type-openqa-selenium-webdriverexception-occurred-in

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