badge How To - Setup Selenium Java project in Eclipse IDE ~ Tech Siddhi










Thursday 23 January 2014

How To - Setup Selenium Java project in Eclipse IDE

Step by Step process to setup Selenium WebDriver project in Eclipse IDE.

Step1: Download Java JDK and install if not installed already.

Download Link: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Step2: Download Eclipse if not installed already on your system.

Download Link: http://www.eclipse.org/downloads/ 

Step3: Set up Workspace for your project in eclipse.

Navigate to File Menu -> Workspace . Specify folder path where you want to store all files related to your project.

Step4: Create New Project

Go to File Menu -> New -> Select Java Project

Give a name to your project , select Java Runtime Environment

Next - > Finish

You can see a project is created with src folder for storing source code and class files. JRE library is also attached.

Step5: Download Selenium Server and Client for WebDriver.

Download Link: http://docs.seleniumhq.org/download/

Step6: Extract Jar files from Selenium Client zip folder.

Step7: Add Selenium Jars to your project.

To do this make a Folder in project (Right click on project name -> New -> Folder) and name it as lib.

Now, drag Selenium Server jar (selenium-server-standalone-2.39.0) for version 2.39.0 to lib folder.

Open unzipped client folder and drag Client jar (drag jar not having srcs to lib folder eg: add jar with name "selenium-java-2.39.0" and not "selenium-java-2.39.0-srcs" to your project lib )

Select both jars in lib folder -> Right click -> Add Build path

After doing this automatically Referenced Libraries folder should be created and jars should be attached there.

Step8: Download Junit

Download Link: http://sourceforge.net/projects/junit/files/junit/

Add Junit jar to project same way as we added Webdriver jar files in Step7.

Step9: Record a web test using Selenium IDE extension for Firefox.

Step10: Export Test Case as  - Java/ Junit4 / WebDriver

Save test case in src folder of your eclipse project with .java as extension.

Step11: To run your test case , Right click anywhere in code area -> Run As -> JUnit Test

Below is the video for all these steps for reference.


0 comments:

Post a Comment