【发布时间】:2017-09-21 17:55:23
【问题描述】:
我已经更新了最新的 selenium webdriver (v 3.4.0) 并安装了最新的 firefox 驱动程序 (0.15.0)。我将这些安装在我正在通过“管理 Nuget 包”选项处理的项目中。突然间,我的所有测试都失败了,因为它无法与 Firefox 浏览器上的任何元素进行交互。为了说明我的问题,当我在谷歌网站上尝试以下简单测试时
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 中指定这些路径的情况下执行的,因为当我们使用“管理 Nuget 包”选项安装所需的包时,firefox 会选择它们。我不知道为什么它突然开始失败。有人对此有什么建议吗?
【问题讨论】:
-
如果你使用 geckodriver 0.16 会发生什么?
-
我没用过。我正在检查它。只是想知道,它是否类似于驱动程序文件?
标签: c# selenium selenium-webdriver automated-tests selenium-firefoxdriver