Articles → SELENIUM → Create Your First Selenium Project

Create Your First Selenium Project






Webdriver Class





Create Your First Selenium Project




  1. Open Eclipse
  2. Click on File → New → Java Project
  3. Picture showing the New - java project menu option for creating the new Java project

    Click to Enlarge

  4. In the next window, enter the project name and click on ‘Finish’.
  5. Picture showing the popup window for entering the project name

    Click to Enlarge

  6. A Project is created in package explorer as shown in figure below
  7. Project showing the project in the package explorer

    Click to Enlarge

  8. Next step is to add a package, right click on the project → New → Package
  9. Picture showing the New - Package option for adding the new package in the project

    Click to Enlarge

  10. Enter the package name and click on ‘Finish’
  11. Picture showing the popup window for entering the package name

    Click to Enlarge

  12. Next step is to add a class. For doing that right click on the package → New → Class
  13. Picture showing the New - Class option for adding the class in the package

    Click to Enlarge

  14. Enter the class name and click on ‘Finish’
  15. Picture showing a popup window for entering the class name

    Click to Enlarge

  16. Next step is to configure path. For that right click on JRE System Library [JavaSE – 1.8] → Build path → Configure Build Path..
  17. Picture showing the Build path -Configure build path option for configuring the build path

    Click to Enlarge

  18. From the window, click on ‘Add External JARs..’.
  19. Picture showing a window for adding external jar files

    Click to Enlarge

  20. Once you click on the button, a file dialog will open to select ‘selenium-server-standalone-2.53.1.jar’.
  21. Select the file and click on ‘Open’ and finally close the ‘Configure Build Path..’ window.

Download Iedriverserver




Picture showing a browser window for downloading the IEDriverServer.exe file

Click to Enlarge


Write Your First Selenium Code




package com.FirstSeleniumProject;

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

public class MyClass {

  public static void main(String[] args) {
    WebDriver driver;
    String service = "IEDriverServer.exe path";
    System.setProperty("webdriver.ie.driver", service);
    driver = new InternetExplorerDriver();
    driver.get("http://google.com/");

  }
}



Output




Picture showing the output of your first selenium project

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Sunday, March 26, 2017

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250