Java Installation:
Step
1: Go to Oracle official site – “JAVA download”, download Java Platform, Standard
Edition. All the recent releases are available on the page.
Step
2: As soon as you click on the Download button, following screen would
appear. Accept the License agreement for Java installation and choose amongest
the various cataloged Java Development Kit’s. Select the one that best suits
your system configuration.
Remember to download JDK
(Java development kit). The kit comes with a JRE (Java Runtime environment).
Thus the user isn’t required to download and install the JRE separately.
Eclipse IDE Installation
Step 1: Go to Eclipse official website and
navigate to its download page – Eclipse download. Click on Eclipse for
Testers link and select a version of eclipse which you want. Download Eclipse
IDE for Java EE developers. All the recent releases are available on the page.
http://mirrors.ustc.edu.cn/eclipse/technology/epp/downloads/release/neon/M6/eclipse-jee-neon-M6-win32-x86_64.zip
Make sure you opt and download the appropriate eclipse IDE
as per your system configuration. There are two download links available for 64
bit windows operating system and 32-bit windows operating system.
Step
2: As soon as
we click on the Eclipse for Testers link, the user is re-directed to the Listing
page of Different versions of Eclipse. Click on any version of Eclipse from
left side in Release list. Then click on Eclipse for Testers download links
according to requirement. After that, the user is re-directed to fresh page
securing information about the current download. Click on the download icon and
you are done.
It may take a few minutes before you can download the
complete zip folder.
Step 3: Once
downloaded, copy the folder and place it in the desired location on your file
system.
Step
4: Extract
the zipped folder, a folder named as eclipse can be seen. The folder embodies
all the required application and source files.
Step 5: Launch
the eclipse IDE using “eclipse.exe” residing inside the eclipse folder. Refer
the above illustration for the same.
Step 6: The
application will prompt you to specify the workspace location. Workspace is
that location where all your eclipse projects will be residing. Enter/Browse
the desired location or the user can simply opt for the default location and
click on the OK button.
Configuring WebDriver
As we would be using Java as the programming language for
this series and in order to create test scripts in java, we would have to
introduce language- specific client drivers. Thus, let us begin with the
downloading of Selenium Java Client Libraries.
Download the
Selenium Java Client Libraries
Step 1: Go
to Selenium’s official website and navigate to its download page – “http://docs.seleniumhq.org/download/”. Refer the section in
the below illustration where you can find Client Libraries listed for distinct
programming languages. Click on the download link for Java Client Library.
It may take a few minutes before you can download the
complete zipped folder.
Step 2: Once
downloaded, copy the folder and place it in the desired location on your file
system.
Step 3: Extract
the zipped folder, a folder named as “Selenium-2.53.0.zip“can be seen. The
folder embodies all the required jar files which enable users to create test
scripts in Java.
Thus these libraries can be configured in Eclipse IDE.
Download the
Selenium Java Server Libraries
From here you can directly download the selenium-server-standalone-2.53.0.jar
file.
Configuring
Libraries with Eclipse IDE
Step 1: Navigate
towards Eclipse IDE. Create a new java based project following File -> New
-> Java Project. Refer the following figure for the same.
Step 2: Provide
a user defined name for your Java Project. Let us provide the name as
Learning_Selenium and Click on the Finish Button. The newly created project can
be viewed at the left side of the screen in the package explorer panel.
Step 3: Create
a new Java class named as “First_WebdriverClass” under the source folder by
right clicking on it and navigating to New -> class.
Step 4: Now
let us configure the libraries into our Java project. For this, select the
project and Right click on it. Select “Properties” within the listed options.
The following screen appears, Select “Java Build Path” from the options.
Step 5: By
default, “Libraries” tab is opened. If not, click on the “Libraries” tab. Then,
click on the “Add External Jars…” button. Browse to the location where we have
saved the extracted folder for Java Client Libraries.
Step 6: Select
all the JAR files present in the “selenium-java-2.41.0” folder and click on
open button within the dialog box. The properties dialog box should look like
the below illustration.
Step
7: Click on
the “OK” button within the dialog box so as to complete the configuration part
of Selenium Libraries in our java project.
The project
will look like the following:
Available Drivers
There are a number of driver
classes available in WebDriver, each catering a specific web browser.
Each
browser has a different driver implementation in WebDriver.
In WebDriver, a few of the
browsers can be automated directly where as some of the web browsers require an
external entity to be able to automate and execute the test script. This
external entity is known as Driver Server. Thus, user is required to download
the Driver Server for different web browsers.
Notice that there is a separate
Driver Server for each of the web browser and user cannot use one
Driver Server
for web browsers other than the one it is designated for.
Below is the list of available
web browsers and their corresponding Server Drivers.
Conclusion
Prior to the creation of
WebDriver based test scripts, few utilities and packages are required to be
installed.
- Install JDK (Java Development Kit). Remember, the user is not supposed to install JRE separately because it is distributed bundled with the kit.
- Download Eclipse IDE. User is only required to download the package and he/she is good to go. No other installation is required with Eclipse.
- Download Java Client Libraries to be able to create test script in java programming language.
- Launch eclipse using eclipse.exe. Select the workspace where you would want to save the projects.
- Create a new java project in the eclipse. Create a new java class within the project.
- Configure the eclipse by importing jars files for Java Client Drivers.
- In WebDriver, a few of the browsers can be automated directly where as some of the web browsers require an external Driver Server.
- Firefox and HTML Unit are the only browsers that cannot be automated directly. Thus they do not require any separate Driver Server. All other commonly known web browsers like Chrome, Safari, Internet Explorer etc. requires Driver Servers.