Untitled Document
Chapter - 2 - Configuring Selenium and Its Jar's

In our previous chapter we have seen installtion of java and Eclipse IDE , now in this chapter we will add some selenium jars of java and will try to run some automation script . As discussed earlier we will be using java as a scfripting language for selenium automation as we have most numbers of readily available automation code in open source community .

Rather than discussng it lets get the required Jars (files) from http://www.seleniumhq.org/download/

Step 1

Responsive image

Step 2

Now unzip all the downloaded jars in a folder . To get the Jars added for use , got to the eclipse create a project as shown below 

Responsive image

Step 3 - 

On the pop window Give project name as -

Responsive image

Step 4 - 

You will see a new Project MySelenium will be added -

Responsive image

Step 5 - 

Now to extract jars create a folder called library and extract all the jars in the library folder . -

Responsive image

Step 6 - 

On Popup window Select Project Myselenium and type folder name as library , click finish . Library folder is created . once you create the folder you can see the library folder in MySelenium project

Responsive image

Step 7 - 

The library folder is added to the MySelenium Project

Responsive image

Step 8 - 

Now lets add the jars which we have downloaded in the Library folder . To add the Jars follow the steps shown below .Right click on library folder go to Build Path - > Configure Build Path

Responsive image

Step 9 - 

A pop up window will open , on pop window click on Add External Jar's

Responsive image

Step 10 - 

After clicking , it will ask you to go to the location where we extracted our Jars , go to the lib folder of the extracted jars and select all the jars , click ok

Note - Best way is to copy the jars to the library folder first C:\Users\lenovo\workspace\MySelenium\Library or extarct the Jars in library folder and from there you can add the jars to your project.This is the best practice to follow.

Responsive image

Step 11 - 

Copying Jars in the library folder , make sure you copy all the files from bin and outside bin folder in library folder from the folder where you have extracted jars .Once you copy it follow the Step -8 ,Step-9 and Step-10 . On Step 10 give the library folder path which we have created for the project .

You will see the new Refrenced Libraries added to you project .

Responsive image

Now expand Your Library folder you will see the symbol highlighted in image shown below.

Responsive image

Finally click on Ok and we have have added selenium jars in our project !!!

Step 12

Now its time to run a sample code for test .The code will open a Mangu The Geek Webpage in firefox

   package Mytest;
   import org.openqa.selenium.firefox.FirefoxDriver; 
   public class MyFirstTest
   { 
      public static void main (String args[])
       {
         FirefoxDriver mangesh;
         mangesh = new FirefoxDriver();
         mangesh.get("http://www.mangadaku.com/");
       }
   }

If firefox browser open Magu The Geek means we are on the way to start Selenium Automation .

How To Get or Install TestNG in Eclipse -

Here are the steps to install or COnfigure the TestNg .Go to google.com and in google search bar type - TestNg Eclipse ; select the first link (http://testng.org/doc/download.html) from the webpage select the link (http://beust.com/eclipse) , Open Eclipse 

Once you have installed it , Lets configure it by rebuild its path

Untitled Document