How to Install Selenium WebDriver in Eclipse IDE
So let’s start with the step-by-step installation process:
- Install Java Development Kit
- Download Eclipse IDE
- Install Selenium WebDriver
- Configure Selenium WebDriver with Eclipse
Download and Install Java Development Kit
Java is a prerequisite for Eclipse IDE. If you already have JDK installed on your system, you can skip this step and jump straight to downloading Eclipse.
Click here to go to Java Development Kit download page. The latest versions of Java JDK and JRE are listed on this page. As of writing, Java SE 10.0.1 is the latest feature release. Click on the “Download” button corresponding to JDK.
On clicking the download button, you’ll be taken to a page listing JDKs for different OSes. Accept the license agreement and click download “jdk-10.0.1_windows-x64_bin.exe” for Windows.
Once the download finishes, install JDK on your system. The Java Development Kit comes bundled with Java Runtime Environment(JRE) as well. So you don’t have to download JRE separately.
To verify JDK is successfully installed, launch a Command Prompt console, and type in java -version. This should show you the version details you just installed
Download and Install Eclipse IDE
With JDK successfully installed on the system, we can now proceed with Eclipse set up. Click here to go to Eclipse IDE download page. On this page you’ll find the 32 bit and 64 bit download links for the recent releases.
Download the appropriate version of “Eclipse IDE for Java EE Developers” for your system.
Once downloaded, extract the ZIP file to the desired location on your computer. Among the extracted files, you’ll find an executable file named – “eclipse.exe” – double-click on this file to start Eclipse IDE.
Eclipse should prompt for a workspace location on start. Workspace is the location on your system where all the project files would reside. Enter a custom location or go with the default one by directly clicking on “OK” button.
Next, let’s install Selenium in Eclipse.
Download and Install Selenium WebDriver
As we are going to write our scripts in Java language, we would be needing the Selenium Java Client Libraries. Click here to go to Selenium download page.
Scroll down the download page until you come across “Selenium Client & WebDriver Language Bindings” section. Under this section, click on the download link for Java Library files. Download, again, is a ZIP file.
Once the ZIP file is downloaded, extra the archive content to a folder on your computer. Inside this folder are the JAR libraries we are going to import into our project in Eclipse in the next step.
Configure Selenium WebDriver with Eclipse
Eclipse should be running from the workspace you had selected earlier. Now, we are going to create a new Java Project and add the downloaded Selenium JAR files into it.
To do that, go to File > New > Java Project. Enter a name for the new project – I’m naming this example as “SumTips” – and click the “Finish” button. The project should be now listed under the Package Explorer panel on the left.
Now, let’s configure the downloaded library files into our Java project. Right-click on the project name from Package Explorer panel > Select Properties. This will open a new dialog with all the properties for this project. Select “Java Build Path” from the list and switch over to “Libraries” tab. Click on “Add External JARs” button and navigate to the folder where you had saved the Selenium files. Select all JAR files inside the folder and click “Open” button to add them.
Finally, click on “Apply and Close” button for the “Properties” dialog.
That’s it! We have successfully installed Selenium WebDriver and configured it with Eclipse. Next, we will be seeing how to Install TestNG in Eclipse.