相关疑难解决方法(0)

必须通过webdriver.ie.driver系统属性设置驱动程序可执行文件

我正在使用Selenium来自动化测试.我的应用程序专门使用IE,它不适用于其他浏览器.

码:

import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class Test {
    public static void main(String[] args) {
        final String sUrl = "http://www.google.co.in/";                             
        System.setProperty("webdriver.chrome.driver","C:\\Users\\vthaduri\\workspace\\LDCSuite\\IEDriverServer.exe");
        WebDriver oWebDriver = new InternetExplorerDriver();
        oWebDriver.get(sUrl);
        WebElement oSearchInputElem = oWebDriver.findElement(By.name("q")); // Use name locator to identify the search input field.
        oSearchInputElem.sendKeys("Selenium 2");
        WebElement oGoogleSearchBtn = oWebDriver.findElement(By.xpath("//input[@name='btnG']"));  
        oGoogleSearchBtn.click();

        try {
            Thread.sleep(5000);
        } catch(InterruptedException ex) {
            System.out.println(ex.getMessage());
        }
        oWebDriver.close();
    }    
}
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误

必须通过webdriver.ie.driver系统属性设置驱动程序可执行文件的路径; 有关更多信息,请参阅https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver.最新版本可以从http://www.seleniumhq.org/download/ 2012年6月12日下午4:18:42 下载org.apache.http.impl.client.DefaultRequestDirector tryExecute INFO:I/O异常(java.处理请求时捕获的net.SocketException:软件导致连接中止:recv失败2012年6月12日下午4:18:42 org.apache.http.impl.client.DefaultRequestDirector tryExecute

有人可以帮我吗?

java internet-explorer webdriver system-properties selenium-webdriver

57
推荐指数
2
解决办法
22万
查看次数