Microsoft Edge WebDriver-意外错误.未知错误 [英] Microsoft Edge WebDriver - Unexpected error. Unknown error

查看:277
本文介绍了Microsoft Edge WebDriver-意外错误.未知错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当尝试使Microsoft Edge自动化与Selenium配合使用时,出现以下异常:

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

OpenQA.Selenium.WebDriverException:意外错误.未知错误

OpenQA.Selenium.WebDriverException: Unexpected error. Unknown error

我正在使用 Selenium.WebDriver.MicrosoftDriver NuGet程序包,版本17.17134.0.

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

没有运气.我确保Microsoft的WebDriver版本与运行测试的计算机上的Edge版本匹配.

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

有什么办法可以在这里获得更详尽的错误消息吗?请注意,所有Selenium单元测试都可以在Firefox和Chrome WebDrivers上正常运行,只有Edge无法使用.

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.

推荐答案

我知道您提到过相同的版本,但是我自己遇到了相同的错误,因此这是我解决的方法,希望对您有所帮助.

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.

Microsoft似乎不再以独立版本发布Web驱动程序,这可能是问题所在. (请参阅此处有关更多详细信息),目前Edge的版本似乎为17763,而NuGet软件包的版本为17134.因此,我要做的就是进入并通过设置>应用程序>应用程序和应用程序将其独立安装" ;功能>管理可选功能."上面的链接中包含一些其他指导.

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

这篇关于Microsoft Edge WebDriver-意外错误.未知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆