繁体   English   中英

在Firefox驱动程序中执行自动化测试时,WebDriver.dll中发生System.InvalidOperationException

[英]System.InvalidOperationException occurred in WebDriver.dll while doing automation testing in Firefox driver

我已经更新了安装的最新硒Web驱动程序(v 3.4.0),并具有最新的firefox驱动程序(0.15.0)。 我将这些安装在通过“管理Nuget软件包”选项进行工作的项目中。 突然我的所有测试都失败了,因为它无法与firefox浏览器上的任何元素交互。 为了说明我的问题,当我在Google网站上尝试以下简单测试时

IWebDriver driver = new FirefoxDriver();
driver.Url = "https://www.google.com/";
var MyKeyWord = driver.FindElement(By.Id("lst-ib"));
MyKeyWord.SendKeys("Gmail");

它失败,出现以下异常。

An unhandled exception of type 'System.InvalidOperationException' occurred in WebDriver.dll

Additional information: Expected [object Undefined] undefined to be a string (IndexOutOfBounds)

我正在研究如何处理此问题,并找到了以下解决方案:driver = new FirefoxDriver(DRIVER_PATH);

但是我执行的所有测试都没有在firefox中指定这些路径,因为当我们使用“ Manage Nuget Packages”选项安装所需的软件包时,firefox会选择它们。 我不确定为什么它突然开始失败。 有人对此有任何建议吗?

https://github.com/mozilla/geckodriver/releases下载最新的geckodriver。 解压缩它,然后将gecodriver文件放入系统路径。 重新启动(如果需要)。

该链接将有助于设置: https : //github.com/mozilla/geckodriver

希望对您有所帮助。

NuGet管理器中有两个Chromedriver显示-一个Chrome驱动程序,另一个是Selenium Google Chrome驱动程序。 您必须同时安装两者,然后它才能工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM