Microsoft Edge WebDriver - Unexpected error. Unknown error

﹥>﹥吖頭↗ 提交于 2019-12-06 02:58:19

问题


I am getting the following exception when trying to get Microsoft Edge automation to work with Selenium:

OpenQA.Selenium.WebDriverException: Unexpected error. Unknown error

I am using the Selenium.WebDriver.MicrosoftDriver NuGet package, version 17.17134.0.

My code is simply the constructor:

var driver = new EdgeDriver();

I have tried various overloads that are suggested:

var driver = new EdgeDriver(new EdgeOptions());

var driver = new EdgeDriver(pathToMicrosoftWebDriverExecutable);

No luck. I made sure that the WebDriver version from Microsoft matched the Edge version on the machine running the tests.

Is there any way I can get a more informative error message here? Note that all Selenium unit tests work as expected with both the Firefox and Chrome WebDrivers, it's only Edge that won't work.


回答1:


I know you mentioned you had the same versions, but I was getting the same error myself and this is how I resolved it so hopefully this helps.

It appears that Microsoft is no longer releasing the Web Driver as a standalone version, which may be the issue. (See here for more details) Currently, Edge seems to be at version 17763, whereas the NuGet package is 17134. So what I had to do was go in and "install it as a standalone by going to Settings > Apps > Apps & features > Manage optional features." There are some alternative directions that are included in the link above.

Once that installed I pointed the driver to the location and it finally worked.

var driver = new EdgeDriver("C:\\Windows\\System32\\", edgeOptions);



回答2:


I'm not sure how or why, but this worked for me, also. I was getting the pesky "Message: OpenQA.Selenium.WebDriverException : Unexpected error. Unknown error".

I followed Brian Murphy's instructions to install Microsoft Edge Driver as a Standalone by managing my optional features. I don't know where windows installed it, and I didn't need to change any of my code in C#, and my test which was previously failing at Driver = new EdgeDriver(edgeService, options);

once again started to pass.



来源:https://stackoverflow.com/questions/53540426/microsoft-edge-webdriver-unexpected-error-unknown-error

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