<分区>
我正在研究 C#
中的 selenium webdriver。当我运行测试用例测试浏览器IE
时,出现这个错误:
Test method AgileTravelUITests.GoogleSearchTest.TestIE threw exception: OpenQA.Selenium.DriverServiceNotFoundException: The IEDriverServer.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://selenium-release.storage.googleapis.com/index.html.
我尝试使用 IEDriverServer_x64_2.53.0.zip
下载并安装 2.53
文件夹,但这没有用。
这是我的代码:
[TestMethod]
public void TestIE()
{
IWebDriver driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl("http://www.google.com");
IWebElement element = driver.FindElement(By.Name("q"));
element.SendKeys("Hello Selenium WebDriver!");
element.Submit();
}
我的代码现在在 IE 中运行良好。您可以点击此链接 Not able to launch IE browser using Selenium2 (Webdriver) with Java Java和C#是一样的。希望对您有所帮助。