Исполняемый файл драйвера должен быть установлен системным свойством 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();
}
}
И вот ошибка, которую я получаю
The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver, Последняя версия может быть загружена сhttp://www.seleniumhq.org/download/ 12 июня 2012 г., 16:18:42 org.apache.http.impl.client.DefaultRequestDirector tryExecute ИНФОРМАЦИЯ: Исключительная ситуация ввода-вывода (java.net.SocketException) при обработке запроса: программное обеспечение вызвало прерывание соединения: сбой recv 12 июня 2012 г., 16:18:42 org.apache.http.impl.client.DefaultRequestDirector tryExecute
Может ли кто-нибудь помочь мне в этом?