Running Selenium Webdriver Test in IE browser using IE Driver - Bug Reaper

                  Bug Reaper

Lean about Automation Testing,Selenium WebDriver,RestAssured,Appium,Jenkins,JAVA,API Automation,TestNG,Maven, Rest API, SOAP API,Linux,Maven,Security Testing,Interview Questions

Saturday 29 November 2014

Running Selenium Webdriver Test in IE browser using IE Driver

Hi Reader,


We can run the Selenium Webdriver tests in Internet Explorer browser using capabilities to perform automation testing.


To Run Selenium test in IE Browser you will need to the latest IE Driver from the following location:


http://selenium-release.storage.googleapis.com/index.html


import java.io.File;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.ie.InternetExplorerDriver;

import org.openqa.selenium.remote.DesiredCapabilities;

public class IE

{

public static void main(String[] args) {

File IEDriver = new File("<Path to IE Driver exe>\IEDriverServer.exe");  

System.setProperty("webdriver.ie.driver", IEDriver.getAbsolutePath() );

DesiredCapabilities caps = DesiredCapabilities.internetExplorer();

caps.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, ""); //INITIAL_BROWSER_URL  is a Capability that defines the initial URL to be used when IE is launched.

WebDriver driver = new InternetExplorerDriver(caps);

driver.get("http://bugreaper.blogspot.in/");  

driver.quit(); 

}
}

No comments:

Post a Comment