4

我收到一个错误:

文件 Capabilities [BrowserName=, IsJavaScriptEnabled=False, Platform=Any, Version=]\IEDriverServer.exe 不存在。可以在http://code.google.com/p/selenium/downloads/list下载驱动程序`

我必须怎么做才能解决这个错误,因为我真的找不到信息....

4

3 回答 3

6

除非您从源代码构建 Selenium 项目,或者正在使用 .NET 绑定并在InternetExplorerOptions类中设置了特定选项,否则您不应该看到此消息。当前的源代码在这个特定领域是不稳定的,因为该项目目前正在为 IE 驱动程序实现独立的可执行服务器的使用,类似于 Chrome 驱动程序目前发生的情况。如果您从源代码构建,或者对使用此新功能感兴趣,您应该从异常消息中指定的 URL 下载独立的 IE 驱动程序服务器可执行文件。

于 2012-05-06T06:44:17.827 回答
0

下载给定 URL 的 IEDriver.exe

http://code.google.com/p/selenium/downloads/list

假设 exe 文件保存在 E:\IEdriver.exe 中。

在 Selenium 中,您必须设置 IEDriver 的属性,因为 Selenium 只有 firefox 驱动程序。

设置系统属性,然后调用 IEDriver。

WebDriver driver;

System.setProperty("webdriver.ie.driver", "E:\\IEdriver.exe");

//Selenium will not support single slash, so we are providing double slash in path.

driver = new InternetExplorerDriver();

// By this it will call the IEDriver and execute

谢谢

于 2014-01-30T11:57:50.020 回答
0

分享一个例子:

public static void main(String[] args) {


        System.setProperty("webdriver.ie.driver", "D:\\selenium\\IEDriverServer.exe");
        WebDriver driver = new InternetExplorerDriver();
        driver.get("www.google.com");
        driver.findElement(By.id("gbqfq")).sendKeys("abc");
        driver.close();

}

}

于 2014-01-30T12:43:11.753 回答