In this tutorial, we will see how to download and install Selenium WebDriver test environment for Java and configure Eclipse IDE with Selenium WebDriver.
So, let’s start first installing Java and Eclipse IDE on your computer.
Install Java and Eclipse IDE on Computer
Follow all the steps for download and installation of Java Software Development Kit (JDK). Here, you can get the complete setup tutorial for downloading and installing Java Development Kit (JDK) step by step.
Just click on this tutorial: Download and Install Java Development Kit in Windows
Once Java installation process and configuration have been completed, it is needed to install Eclipse tool to write Java code. Just click on the given tutorial and follow all steps.
Download Selenium Java Client Driver
In order to create scripts that interact with the Selenium Server (Selenium WebDriver), you need to download Selenium Java Client Driver. The link is given below: Selenium Java Client Driver
You will also get client drivers for other languages there but choose only for Java. You can see the below screenshot.
The downloaded file occurs as a ZIP file named “selenium-java-3.141.59”. Now you extract the contents of this ZIP file on the C drive of your system. It contains all the JAR files that we would later add to Eclipse.
How to Configure Eclipse IDE with Selenium WebDriver?
Follow all steps to configure Eclipse IDE with Selenium WebDriver:
1. Launch the “eclipse.exe” from the “eclipse” folder where it has been installed. Unlike the other software application, eclipse needs to be launched by eclipse.exe file every time to open. So, you can make shortcut it on desktop.
2. Choose a workspace folder for your automation project in the workspace launcher and click on OK button. Workspace is that physical location (file path) where all your projects, source files, and images will be saved by eclipse in your workspace.
You can choose the workspace folder during startup of eclipse or via menu (File < Switch Workspace < Other).
On clicking the OK button, Eclipse launches the screen.
3. Create a new selenium project via File > New > Java Project. Name the project as “seleniumProject”.
A new pop-up window will be opened where you have to enter details as given below:
1. Project Name
2. Location to save the project
3. Select an execution environment JRE
4. Select the project layout (i.e. project folder) for saving source and class file.
5. At last, click on Finish button.
4. Next step is to create a package. For this, right-click on the src folder of newly created project and select New > Package option.
A pop-up window will open to name the package.
1. Enter the name of the package as “seleniumTest”. You can give the name of package as wish according to the project name.
2. Click on Finish button.
5. Make a new Java class by right-clicking under package name and then go to New > Class, and name it as “MyClass”. Your Eclipse IDE should look like the below screenshot.
After creating a class, eclipse screen looks like the below screenshot:
6. Now configure Java Build Path in newly created selenium project. To configure java build path, just follow the below steps:
- Right-click on “seleniumProject” and go to Properties option.
- On clicking Properties option, a new window dialog box will be opened. Click on “Java Build Path”.
- Click on the Libraries tab.
- Click on “Add External JARs..”
7. As you will click on “Add External JARs…” then It will open a pop-up window. Go to the libs folder of selenium client driver where you have saved by downloading and select all the JAR files inside libs folder to add.
8. Now follow the same procedure again and select all JARs files outside the libs folder.
Hope that this tutorial has covered almost all important points related to download and install Selenium WebDriver with following screenshots and step by step. I hope that you will have successfully downloaded and installed Selenium WebDriver and enjoyed it.
In the next tutorial, we will discuss how to write the first test script in Selenium WebDriver with the help of examples.
Thanks for reading!!!
Next ⇒ How to write first script in Selenium WebDriver⇐ PrevNext ⇒