All IT Courses 50% Off
Selenium Tutorials

Selenium JARs Download and Configure in Eclipse

Selenium provides its API implementation in several programming languages like Java, Python, C#, Ruby, etc. However, in the present market Java-based bindings are most popular in the Selenium API. In this article, you will learn how to download Selenium Jars and configure in Eclipse IDE to use them in writing selenium scripts.

To Configure Eclipse IDE with Selenium WebDriver, we need to perform the following steps:

  1. Installing Java
  2. Installing Eclipse IDE
  3. Configure Eclipse IDE with WebDriver

Installing Java on your computer

Step 1: Go to the official website (https://www.oracle.com/technetwork/java/javase/index-137561.html) and click on the platform which you use.  Click on the correct OS corresponding to the specific JDK. (Windows, Mac, Linux, etc) Here, I am clicking on Microsoft Windows as mine is a Windows Operating System.

Selenium JARs Download and Configure in Eclipse

Step 2: Choose the JDK corresponds to your Operating System.

Selenium JARs Download and Configure in Eclipse

Step 3: Click on the Downloads tab.

Selenium JARs Download and Configure in Eclipse

Step 4: Click on JDK Download under Java SE 8u241

Selenium JARs Download and Configure in Eclipse

Step 5: Download the JDK exe file based on your Operating System.

Selenium JARs Download and Configure in Eclipse

Step 6: Accept the License Agreement, by clicking the checkbox “I reviewed and accept the Oracle Technology Network License Agreement for Oracle Java SE” and click Download JDK file.

Selenium JARs Download and Configure in Eclipse

Once clicking on the above exe file, it asks for oracle registration. Login with valid credentials and click on the Sign-In button. The above step will start downloading the JDK exe file automatically. This can be on your system at the bottom left of the browser window.

Selenium JARs Download and Configure in Eclipse

Steps to Install Java

Step 7: Once the download is complete, double click the downloaded .exe file to begin the JDK installation. This will start the installation process. In order to start the installation process click on the Next button.

Selenium JARs Download and Configure in Eclipse

Step 8: Select Development Tools and click on Next.

Selenium JARs Download and Configure in Eclipse

Step 9: It starts the installation and that will take a few minutes to complete.

Selenium JARs Download and Configure in Eclipse

Step 10: Next window will ask for the location where you would like to install Java on your system. You can change the location where you want to keep your folder, but it’s better to stick with the default location. Click on Next to continue.

Selenium JARs Download and Configure in Eclipse

It starts the installation and that will take a few minutes to complete.

Selenium JARs Download and Configure in Eclipse

Step 11: The dialog box confirms the last steps of the installation process. Click on the Close button to complete the Java installation process.

Selenium JARs Download and Configure in Eclipse

Installing Eclipse IDE

After installing Java let’s see how to install Eclipse IDE. The steps are almost the same for Windows, Mac and Linux operating systems.

Step 1: Go to the Eclipse official website (http://www.eclipse.org/downloads) and click the Download button option of the Eclipse IDE icon.

Selenium JARs Download and Configure in Eclipse

Note: For Windows users, if your computer is 64 bit, select Windows 64 and if you have 32 bit, select 32 bit Windows.

Step 2: Click on the eclipse-inst-win64.exe file to download.

Selenium JARs Download and Configure in Eclipse

The above step will start downloading the Eclipse exe file automatically. This can be on your system at the bottom left of the browser window.

Selenium JARs Download and Configure in Eclipse

Step 3: Once the completion of the download, run the exe file to start Eclipse installation for windows.

Selenium JARs Download and Configure in Eclipse

Step 4: In the Installer window click on “Eclipse IDE for Java Developers”

Selenium JARs Download and Configure in Eclipse

Step 5: A new window will appear once click on Eclipse IDE for Java Developers. Change the folder path to “C:/eclipse” and click on the install button.

Note: Before changing the Installation folder you need to create the folder eclipse initially in C drive.

Selenium JARs Download and Configure in Eclipse

You can see the installation process starts running

Selenium JARs Download and Configure in Eclipse

Step 6: A new window will open once after the completion of the installation. Click on the launch button in the new appeared window.

Selenium JARs Download and Configure in Eclipse

Step 7: Once you click on Launch the button it will open Eclipse IDE.

Selenium JARs Download and Configure in Eclipse

Selenium JARs Download

Generally, selenium is not installed, it is configured. We just need to download the Selenium JARs and include them in eclipse.

Step 1: Go to the official website https://www.selenium.dev/ and click on the Downloads tab. 

Selenium JARs Download and Configure in Eclipse

You will find drivers for each different language but here we choose the one for Java and click on Download link.

Selenium JARs Download and Configure in Eclipse

Once you click on the download button, it will start downloading as a ZIP folder automatically. This can be on your system at the bottom left of the browser window.

Selenium JARs Download and Configure in Eclipse

Extract the ZIP folder on to your C drive so that it can save the directory as “C:\selenium-3.141.59\”. This directory contains all the Selenium JAR files.

Configure Eclipse IDE with Selenium WebDriver

Step 1: Launch the “eclipse.exe” file inside the eclipse folder.

Step 2: It will ask to select for a workspace, just click on the Launch button to accept the default location or otherwise you can change the location of your choice.

Selenium JARs Download and Configure in Eclipse

This will launch the Eclipse IDE

Selenium JARs Download and Configure in Eclipse

Step 3: Create a New Java Project from File > New > Project

Selenium JARs Download and Configure in Eclipse

Step 4: Name the Project Name as “Testing” and click the Finish button

Selenium JARs Download and Configure in Eclipse

Step 5: Right Click on your given Project Name (Testing) and select New > Package

Selenium JARs Download and Configure in Eclipse

Step 6: Enter Package name testautomation and click Finish button

Selenium JARs Download and Configure in Eclipse

Once clicking on the Finish button you can see a newly created package name testautomation under project name Testing.

Selenium JARs Download and Configure in Eclipse

Step 7: Right-click on given a package name (testautomation) and select New > Class.

Selenium JARs Download and Configure in Eclipse

Step 8: Enter Class Name NewTest and check the checkbox option public static void main and click the Finish button.

Selenium JARs Download and Configure in Eclipse

Step 9: Now your Eclipse will look like as below

Selenium JARs Download and Configure in Eclipse

Step 10: Now let’s add a few lines of Selenium code without configure JAR files. It will throw us an error message when we won’t add jar files like below.

Selenium JARs Download and Configure in Eclipse

To overcome the above issue we need to add Selenium JAR files to our project.

Step 11: Right-click on Project Testing. Select Properties > Java Build Path. Select the Libraries tab and click Add External JARs button.

Selenium JARs Download and Configure in Eclipse

Selenium JARs Download and Configure in Eclipse

Step 12: Add the client-combined jar file from the selenium jars folder.

Selenium JARs Download and Configure in Eclipse

Step 13: Add all the JAR files under the libs folder.

Selenium JARs Download and Configure in Eclipse

Step 14: Click on Apply and Close button.

Selenium JARs Download and Configure in Eclipse

Step 15: Once Adding Jar files your Package Explorer will look similar to the below image. Here we need to import ChromeDriver and WebDriver classes so that errors related to Selenium classes would get disappeared.

Selenium JARs Download and Configure in Eclipse

Now our Java project is configured with selenium classes.

Selenium Maven Dependencies

Now a day’s most people use Maven as a build tool for Java projects. In that case, it’s very simple to import selenium jars into your project. Just we need to add the following dependencies into your pom.xml file which looks like below.

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>

Steps to follow for a New Maven project

Step 1: Open Eclipse then click on File > New > Project.

Selenium JARs Download and Configure in Eclipse

Step2: Select the Maven Project under the Maven category and click on the Next button.

Selenium JARs Download and Configure in Eclipse

Step 3: Select the checkbox “Use default Workspace location” and click the Next button.

Selenium JARs Download and Configure in Eclipse

Step 4: Select the option maven-archetype-quickstart and click on the Next button.

Selenium JARs Download and Configure in Eclipse

Step 5: Give Group Id, Artifact Id and click Finish button.

Selenium JARs Download and Configure in Eclipse

Step 6: You can see the created maven project in the project explorer window.

Selenium JARs Download and Configure in Eclipse

Step 7: Double click on pom.xml file and the source code get appear in the editor.

Selenium JARs Download and Configure in Eclipse

Step 8: We need to configure the selenium maven dependencies to our project. Go to the https://www.selenium.dev/downloads/ and click on here link.

Selenium JARs Download and Configure in Eclipse

Step 9: Copy and paste the below maven dependency information in pom.xml file which was provided by Selenium guys by default.

Selenium JARs Download and Configure in Eclipse

Step 10: Open pom.xml file creates dependencies tag and paste the Maven dependency code inside the created dependencies tag and save the pom.xml file.

Selenium JARs Download and Configure in Eclipse

Step 11: Expand “Maven Dependencies” under your project to confirm that selenium jars are included in the project are not.

Selenium JARs Download and Configure in Eclipse

Conclusion:  In this article, we learned how to install Java, Eclipse and learned how to add selenium jars to the newly created project and also learned how to add Selenium jars using maven.

Selenium JARs Download and Configure in Eclipse
Facebook Comments
Tags

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button
Close
Close