Creating and Setting Up Selenium Test Automation Environment



Selenium is a great tool and also one of the most popular tool for Test Automation available in the market, in this tutorial we will learn how to setup Selenium Test Automation Environment on Windows 7 Machine for Java Programming Language. This Tutorial is a part of Test automation Series in future parts we'll learn more about DOM Element locators and Executing automated TestCases using Selenium and Java.

Requirements

  • Java JDK 8
  • Eclipse IDE
  • Selenium Packages
  • Selenium Web Drivers (chromedriver)


So let us now setup Test Automation Environment

Step 1 : Install Java on your Computer

Download and Install the JDK.


This JDK version comes bundled with Java Runtime Environment (JRE), so you do not need to download and install the JRE separately.

Once installation is complete, open command prompt and type “java”. If you see the following screen you are good to move to the next step


Step 2 : Install Eclipse IDE

Download latest version of "Eclipse IDE for Java Developers" Be sure to choose correctly between Windows 32 Bit and 64 Bit versions.
Execute the Eclipse IDE Installer
Follow the Basic Installation Steps
Finish.

Step 3 : Download Selenium Java Client Driver

You can download the Selenium Java Client Driver. You will find client drivers for other languages there, but only choose the one for Java:

This download comes as a ZIP file named "selenium-2.25.0.zip". For simplicity, extract the contents of this ZIP file on your C drive so that you would have the directory "C:\selenium-2.25.0\". This directory contains all the JAR files that we would later import on Eclipse.

Step 4 : Configure Eclipse IDE with WebDriver

The Docker service needs to be setup to run at startup. To do so, type in each command followed by enter:
1. Launch Eclipse IDE
2. Accept Default location for workspace, click ok.
3. Create a new project through File > New > Java Project. Name the project as "newproject".


4. Fill in theProject Details, Click on Finish
5. Right Click on newly Created Project and
6. Select New >> Package and name the package as "newpackage"
7. Right Click on newly Package and
8. Select New >> Class and name the package as "MyClass" >> Click on Finish

This is how it looks after creating a class


Now selenium WebDriver's into Java Build Path

1. Right-click on "newproject" and select Properties.
2. On the Properties dialog, click on "Java Build Path".
3. Click on the Libraries tab, and then
4. Click on "Add External JARs.."
5. Add All the Jar Files We've downloaded and Extracted.
Once you are done adding all the jar files it looks like this.:


Once Done, Click "Apply & Close Button"

Add all the JAR files inside and outside the "libs" folder. Your Properties dialog should now look similar to the image below.


Finally, click OK and we are done importing Selenium libraries into our project.

Conclusions

Now we have successfully done setup for Test Automation Environment with Java and Selenium , and now we are ready to execute Automated Test Cases.

Related Download

Java JDK 8 Eclipse IDE

Java Client Driver

ChromeDriver IE Driver

Channels :