Saturday, July 15, 2017

First Selenium Webdriver Script Using Internet Explorer Driver

In this tutorial, I will give a small explanation about the IE Web Driver, Through which we will load the webpage in IE browser.

Before starting with programming you need to download the IE driver. Driver file you will get it from the selenium official website ( http://www.seleniumhq.org/ ).

Following source code is use to launch the browser page using IE driver.

SeleniumDemo.java

package demo;

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

public class SeleniumDemo {

 // variable name
 public static WebDriver driver;

 public static void main(String[] args) {
  // TODO Auto-generated method stub

  System.out.println("Launching the Internet Explorer driver  ");
  // set the path for IE Driver
  System.setProperty("webdriver.ie.driver",
    "D:\\selenium_sumit\\chromedriver_win32\\IEDriverServer.exe");
  driver = new InternetExplorerDriver(); // Instantiate the IE driver

  driver.get("https://www.google.com"); // set the URL
  System.exit(0);

 }

}


To run and execute the code in Eclipse IDE, you need to follow the below step:
  • On Eclipse's menu bar, click Run > Run.








No comments:

Post a Comment