Wednesday, 26 March 2014

Configure Selenium WebDriver, Java and Eclipse

Java:

Download and Install latest Java SE Development Kit 7 (JDK) from Oracle



Setup environment variables for Java:

Windows 7:
  1. Select Computer from the Start menu > Properties
  2.  Click Advanced system settings > Advanced tab
  3. Click on Environment Variables, under System Variables, find PATH, and click on it.
  4.  In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
  5. Click Ok.


For other platforms, please refer http://www.java.com/en/download/help/path.xml

Eclipse

  • Download Eclipse (Eclipse IDE for Java Developers) from http://www.eclipse.org/downloads/
    Note: Make sure to choose correct version as per your OS (Windows 32 Bit and 64 Bit).


  • Unzip the ‘eclipse’ folder from the zip to some directory.

Download Selenium Client & WebDriver Language Bindings

Download latest WebDriver bindings from official website http://docs.seleniumhq.org/download/
and unzip the selenium-java-2.x.x.zip folder to some directory.



Setup a Project in Eclipse:

Launch eclipse: Launch eclipse and provide workspace location.


Select Workbench:



Create a new project: Click on File menu –> New –> Java Project -> Enter project name as “Selenium_Automation” and click finish.



Configure Build Path:  

Right click on Project Name > Properties > select Java Build Path… > select Libraries tab > click Add External JARs... > add WebDriver JARs (by providing the location of extracted WebDriver language bindings/JARs)
OR
Right click on Project Name > Build Path > click Configure Build path… > select Libraries tab > click Add External JARs... > add WebDriver JARs (by providing the location of extracted WebDriver language bindings/JARs )


 Now your environment is ready to run selenium scripts



No comments:

Post a Comment