Selenium Webdriver For Beginners.

Jan 12 2017

What is Selenium WebDriver?

Selenium WebDriver is open source software testing tool which supports many different browsers. It is also supporting many different software programming languages like Python, Ruby, C#, Java, PHP and Perl so that you can create your test cases using your preferred language. Currently, the most popular language Is Java to prepare your software application automation test cases with selenium webdriver.

How to download selenium and install Selenium Webdriver with Eclipse and Java Step By Step?

Downloading selenium webdriver and installing selenium webdriver is easy. You need to download selenium jar files. Then configure downloaded selenium jar files in eclipse. Actually there is nothing to install except JDK. Let me describe you step by step the process of download, installation and configuration of web driver software and other required components.

Steps To Set-up and configure Selenium Webdriver With Eclipse and Java

Step 1 : Download and install Java in your system

First of all you need to install JDK (Java development kit) software in your system.

Step 2 : Download and install Eclipse in your system

Download Eclipse for Java Developers and extract “save it” in any drive. It is totally free. You can run ‘eclipse.exe’ directly so you do not need to install Eclipse in your system.



Step 3 : Download WebDriver Jar Files.
Selenium webdriver supports many languages and each language has its own client driver. Here we are configuring selenium 2 software with java so we need ‘webdriver Java client driver’.
Click here to go on WebDriver Java client driver download page for webdriver download file. On that page, click on ‘Download’ link of java client driver as shown in below image.

Download and install Selenium Java Client Driver

(language-specific client driver’s version is changing time to time so it may be different version when you will visit download page. )

Downloaded ‘webDriver Java client driver’ will be in zip format. Extract and save it in your system at path D:\selenium-2.33.0. There will be ‘libs’ folder, 2 jar files and change log in unzipped folder as shown in below figure. We will use all these files for configuring webdriver in eclipse.

 

 

Java client driver for webdriver

Step 4 : Start Eclipse and configure it with selenium 2 (webdriver)

  • Select WorkSpace on eclipse start up

Double click on ‘eclipse.exe’ to start eclipse software application. First time when you start eclipse software application, it will ask you to select your workspace where your work will be stored as shown in below image. Create new folder in D: drive with name ‘Webdriverwork’ and select it as your workspace. You can change it later on from ‘Switch Workspace’ under ‘file’ menu of eclipse.

Selecting workspace in eclipse

After selecting workspace folder, Eclipse will be open.

  • Create new project

Create new java project from File > New > Project > Java Project and give your project name ‘testproject’ as shown in below given figures. Click on finish button.

Create new webdriver project in eclipse

Create new java project in eclipse

Now your new created project ‘testproject’ will display in eclipse project explorer as below.

Webdriver project on project explorer

Create new package

Right click on project name ‘testproject’ and select New > Package. Give your package name = ‘mytestpack’ and click on finish button. It will add new package with name ‘mytestpack’ under project name ‘testproject’.

Creating new package in eclipse

Create New Class

Right click on package ‘mytestpack’ and select New > Class and set class name = ‘mytestclass’ and click on Finish button. It will add new class ‘mytestclass’ under package ‘mytestpack’.

Creating new class for webdriver

Now your Eclipse window will looks like below.

webdriver configuration with eclipse

Add external jar file to java build path

Now you need to add selenium webdriver’s jar files into java build path.

  • Right click on project ‘testproject’ > Select Properties > Select Java build path > Navigate to Libraries tab

  • Click on add external JARs button > select both .jar files from D:\selenium-2.33.0.

  • Click on add external JARs button > select all .jar files from D:\selenium-2.33.0\libs

Now your testproject’s properties dialogue will looks like below.

Adding webdriver external jar files in eclipse

 


That’s all about configuration of WebDriver software with eclipse. Now you are ready to write your test in eclipse and run it in WebDriver.

Upcoming Post:

>> Create And Run First Webdriver Script With Eclipse.