WebDriver.dll中发生了类型为'OpenQA.Selenium.WebDriverException'的未处理异常.其他信息:意外错误.未知错误 [英] An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll Additional information: Unexpected error. Unknown error

查看:425
本文介绍了WebDriver.dll中发生了类型为'OpenQA.Selenium.WebDriverException'的未处理异常.其他信息:意外错误.未知错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个非常简单的控制台应用程序,以实质上表明在继续使用更高级的应用程序之前,我已经正确设置了Web驱动程序.我正在将C#与硒语言绑定和Microsoft Edge一起使用.

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.

我在此处列出了Selenium Web驱动程序C#语言绑定的3.0版.

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

我具有带有Microsoft EdgeHTML 14.14393的Microsoft Edge版本38.14393.0.0

I have Microsoft Edge version 38.14393.0.0 with Microsoft EdgeHTML 14.14393

我在Windows 10周年纪念版(14393 Build 1607)上,并具有

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

我正在Visual Studio Enterprise 2015中进行测试

I am testing in Visual Studio Enterprise 2015

当我尝试初始化EdgeDriver时,出现此错误:

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.

推荐答案

当我从WebDriver初始化中删除静态修饰符时,它突然开始工作.

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.

这篇关于WebDriver.dll中发生了类型为'OpenQA.Selenium.WebDriverException'的未处理异常.其他信息:意外错误.未知错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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