Home >>Selenium Tutorial >Selenium WebDriver Running test on IE Browser
You'll learn how to run your Selenium Test Scripts on IE Explorer in this section.
Internet Explorer requires Internet Explorer Driver Server to introduce WebDriver protocol. The Driver Server Internet Explorer is the bridge between your Selenium tests and the Internet Explorer Browser.
Let us find a test case where we'll attempt to simplify the following IE browser scenarios.
Our fourth test case will be built inside the same test suite (Demo Test).
Step 1. Right click on the "src" folder and create a new Class File from New > Class. Give your Class name as "Fourth" and click on "Finish" button.
Step 2. Open URL: http://selenium-release.storage.googleapis.com/index.html?path=2.48/ in your browser.
Step 3. Choose the latest version and download as per the operating system you are currently working on.
For windows 64 bit, click on the "IEDriverServer x64 2.48.0 zip" download.
The downloaded file would be in zipped file. Unpack the contents in a convenient directory.
Step 4. Attach a "webdriver.ie.driver" system property to the path of your IEDriverServer.exe script, and instant an IEDriver package.
Here is a code
// System Property for IEDriver System.setProperty("webdriver.ie.driver", "D:\\IE Driver Server\\IEDriverServer.exe"); // Instantiate a IEDriver class. WebDriver driver=new InternetExplorerDriver();
Step 5. We provide embedded comments for each block of code to illustrate the steps clearly.
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetExplorerDriver; public class Fourth { public static void main(String[] args) { // System Property for IEDriver System.setProperty("webdriver.ie.driver", "D:\\IE Driver Server\\IEDriverServer.exe"); // Instantiate a IEDriver class. WebDriver driver=new InternetExplorerDriver(); // Launch Website driver.navigate().to("http://www.google.com/"); //Maximize the browser driver.manage().window().maximize(); // Click on the search text box and send value driver.findElement(By.id("lst-ib")).sendKeys("javatpoint tutorials"); // Click on the search button driver.findElement(By.name("btnK")).click(); } }
Step 6. Right click on the Eclipse code and select Run As > Java Application.
Step 7. The output of above test script would be displayed in Internet Explorer browser.