4/29/17

Configuring Selenium With Eclipse

Downloading Selenium jars:

It will be better to call it Selenium configuration, instead of Selenium Installation. Selenium is basically a set of jars which can be downloaded from here  (this is official site for selenium).
Go to this above mentioned site, at the download page you will see a Download link with the particular language , its version and release date. Once you click on download link, a zip file will be stored in you system. Unzip it and these are selenium jars file.
Selenium Jars

Configure Selenium jars with eclipse project:

For configuring selenium, let’s follow below mentioned steps.
  1. Open Eclipse and Create a java Project
  2. Add Selenium jars to your project
1. Open Eclipse and Create a java Project:
To open eclipse, go to the folder where you have kept the downloaded eclipse files and click on the file highlighted in the screen below.
ECLipse

It will open a window, where you need to choose the workspace (Workspace is nothing but where you will store all the projects). You have option to browser for a desired location and after selecting the location ,click OK
Eclipse Workspace
It will open a welcome page , where it contains some information like samples, eclipse tutorials etc. As of now, you can close this window as shown below.
Welcome eclipse
At the first instance, you might get the window shown below. It will be having the project explorer selected as shown in the screen shot. We need to select the “Package Explorer” instead of “Project explorer”. For that, you need to click on a link shown at the right top corner(Highlighted in red).
Project Exploer
A new window will open where you need to select java option in that.Click OK and it will open a “Package explorer”. This is where we will create our projects.
Eclipse 3


Eclipse in Package Explorer View:

Eclipse Package explorer
  1. Package Explorer: Here we will create the projects containing packages, classes, folders, files etc.
  2. Editor: It is used to write the java code.
  3. Here , you can attach console, properties pane, java doc pane etc. to see output, errors if any.
  4. Outline: This view will shown outline of structured file that is currently opened in editor.
  5. Task List: The Task List is part of Eclipse Mylyn and contains tasks that are downloaded from popular bug trackers like Bugzilla, Trac, Mantis, etc.It is basically used to view and manage the tasks.
  6. Explorer view selection: We can select the desired view like “package explorer” or “project explorer” etc.
  7. Tool Bar: It provides all short cuts like execute code, debug code, New button to create a new item like project, class,folder etc, save buttons, Save all etc.

Create a new Project in Eclipse:
Right click in the “Package Explorer” and select New–> Java Project.
Create Java Project

A new window will open as shown below. Give the desired name in the “Project Name” field and click ‘Finish’.
Create java project
A project will be added in the “package Explorer” that will contain a src folder and JRE system library.
Project added

If you got the above view, that means project is created successfully.


2. Add Selenium jars to the project:

Right click on the project –> Go to Build path –> Configure Build path. (as shown in figure).
Build path


A new window will open, Go to ‘Library tab’ and click on button ‘Add External Jars’ as shown in the figure below.
External jar

After clicking ‘Add External Jars’ , It will open a new window where you can browse to the folder which is having all Selenium jars files. Selenium jars which are required to add shown in the below screen shot. Add those 2 jars and all the jars inside lib folder.
Add jars

After selecting all jars, Click OK button.
Selenium Jars
Finally, all the external jars should be displayed inside a folder named ‘Referenced Libraries’. If you are able to see that, then You are ready to start Selenium.
Reference libraries

0 comments:

Post a Comment

Google Q&A Forum