Selenium WebDriver- Installation

Selenium WebDriver installation process is completed in four basic steps:

  1. Download and Install Java 8 or higher version.
  2. Download and configure Eclipse or any Java IDE of your choice.
  3. Download Selenium WebDriver Java Client
  4. Configure Selenium WebDriver

1. Download and Install Java

We assume that you have already installed Java 8 or above on your machine and successfully configured the environment variables required to run and compile java programs.

Note
Note: you'll need to have Java 8 installed to use Selenium 3.

However, you can download the latest version of Java Development Kit (JDK) from the link given below.

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Once you have downloaded and installed the latest version of Java, you need to set path or configure the environment variables in your system. Refer the link given below to understand how we can set path and configure environment variables in Java.

https://www.rookienerd.com/how-to-set-path-in-java

2. Download and Configure Eclipse IDE

  • Open URL: https://www.eclipse.org/downloads/ .
  • Click on the "Download Packages" link (you can also download the IDE directly from the "downloads page" of Eclipse official website, but we will recommend you to navigate through the download packages section and get "Eclipse IDE for Java Developers").
Selenium WebDriver Installation
  • It will redirect you to the "Download Packages" section. Scroll down through the webpage and click on "Eclipse IDE for Java Developers".
Selenium WebDriver Installation
  • Go to the Download Links section and click on "Windows 64-bit". You can also select other options to download based on the operating system you are currently working on.
Selenium WebDriver Installation
  • The downloaded file would be in zipped format. Unpack the contents in a convenient directory.
Selenium WebDriver Installation
  • Double click on "eclipse" (.exe file).
Selenium WebDriver Installation
  • To configure the workspace, select a convenient directory where you want to keep all of your Selenium trails and click on Launch button.
Selenium WebDriver Installation
  • It will launch the default interface of Eclipse IDE.
Selenium WebDriver Installation

3. Download Selenium WebDriver Java Client

  • Open URL: https://docs.seleniumhq.org/download/
    It will redirect you to the "downloads page" of Selenium official website.
  • Scroll down through the web page and locate Selenium Client & WebDriver Language Bindings.
  • Click on the "Download" link of Java Client Driver as shown in the image given below.
Selenium WebDriver Installation
  • The downloaded file would be in zipped format. Unpack the contents in a convenient directory. It contains the essential jar files required to configure Selenium WebDriver in Eclipse IDE.
Selenium WebDriver Installation

4. Configure Selenium WebDriver

Now we will configure our Eclipse IDE with Selenium WebDriver. In simple terms, we will create a new Java Project in Eclipse and load all the essential jar files in order to create Selenium Test Scripts.

  • Launch Eclipse IDE
  • Create a new Java Project from File > New > Java Project.
Selenium WebDriver Installation
  • Give your Project name as "Demo_Test", leave the other fields unaltered and click on "Finish" button.
  • It will create a new Java project with the following directories.
Selenium WebDriver Installation
Note
Note: Selenium Test Scripts are always written in ".class" file in Java. Here the project "Demo_Test" act as a Test Suite that may contain one or more Selenium test cases/test scripts.
  • Right click on the "src" folder and create a new Class File from New > Class.
Selenium WebDriver Installation
  • Give your Class name as "First" and click on "Finish" button.
Selenium WebDriver Installation

Now, we will add the Selenium jar files in our Test Suite (Demo_Test).

  • Right click on "Demo_Test" folder and select Properties.
Selenium WebDriver Installation
  • It will launch the Properties window for our "Demo_Test" Test Suite.
  • Click on "Java Build Path" option from the left hand side panel.
Selenium WebDriver Installation
  • Switch to Libraries tab and click on "Add External JARs" button.
Selenium WebDriver Installation
  • Locate the directory where you have downloaded the Selenium jar files, select the respective jars and click on "Open" button.
Selenium WebDriver Installation
  • Repeat the same steps for the jars which are present under the "libs" folder.
  • Open "libs" folder, select all of the respective jar files and click on "Open" button.
Selenium WebDriver Installation
  • Once you get all the Selenium jar files in your Libraries tab, click on Apply and Close button.
  • The following image shows the directory structure of our "Demo_Test" test suite after adding Selenium jars.
Selenium WebDriver Installation

Hence, we have successfully configured Selenium WebDriver with Eclipse IDE. Now, we are ready to write our test scripts in Eclipse and run it in WebDriver.

Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +