Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Edge WebDriver - Unexpected error. Unknown error

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.

like image 855
Patrick Avatar asked Nov 29 '18 13:11

Patrick


1 Answers

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);
like image 109
Brian Murphy Avatar answered Sep 23 '22 19:09

Brian Murphy