Tuesday, October 16, 2012

WebDriver - How to run tests on InternetExplorer

1. Download IEDriverServer from http://code.google.com/p/selenium/downloads/list
2.Create WebDriver instance as follows
WebDriver localDriver=;

capability = DesiredCapabilities.internetExplorer();
capability.setJavascriptEnabled(
true);
capability.setCapability(CapabilityType.

TAKES_SCREENSHOT, true);
capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capability.setCapability(CapabilityType.
SUPPORTS_JAVASCRIPT, true);
capability.setCapability(InternetExplorerDriver.
INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
try {
localDriver.setDriver(new RemoteWebDriver(new URL("http://127.0.0.1:5555"), capability));
localDriver.getDriver().manage().timeouts().implicitlyWait(30, TimeUnit.

SECONDS);
}
catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();

}
3. In your testcase method use localDriver
4. Run IEDriverServerxxx.exe
5. Run your tests.

No comments: