By Meghna Gangwar
While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.
Selenium provides its API implementation in multiple programming languages. However, Selenium API Java-based bindings are the most popular. In this tutorial, we will learn how to download Selenium JARs and configure Eclipse IDE to use them in writing test scripts. To configure Eclipse with Selenium WebDriver, we need to perform the following activities:
There has been a major change in the Java Licensing from Java 11 onwards. For commercial purpose, Oracle JDK is not free anymore. However, you can use OpenJDK, which is absolutely free to use in production environment. Read more about it at Java 11 Features.
Let’s see how to install Eclipse IDE for Windows. The steps are almost similar for Mac and Linux operating systems too. You have to follow similar steps with the Eclipse installer files of the corresponding operating system.
Basically, selenium is not installed, it is configured. We just need to download the jars and include in eclipse.
Now you can see a new package name automation under project name Testing.
Let’s go ahead and add Selenium JAR files to our project to fix these errors.- Step 11: Right click on Project Testing. Select Properties > Java build Path. Then click on Libraries tab and click Add External JARs.
That’s it. Our Eclipse Java project is configured to use selenium classes.
Most of the java project these days use Maven as the build tool. In that case, it’s very easy to import selenium jars into your project. Just add the following dependencies into your project pom.xml file.
<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version> </dependency>
If you are new to maven project, here are the steps to follow.
Selenium Maven Dependencies[/caption]- Step 10: Check your project “Maven Dependencies” to confirm that selenium jars has been downloaded and included in the project. [caption id=“attachment_26207” align=“aligncenter” width=“347”]
Gradle is also a popular build tool and used by a lot of projects. If you are using Gradle, then add below dependencies to your build.gradle file.
We learned how to configure our system to start working with Selenium. We installed Java, Eclipse and created a new project and added selenium jars to it. However, it’s better to use Maven or Gradle build tools for our project, we also learned how to add Selenium jars using maven and Gradle script. References: Java SE Download, Eclipse Download,Selenium Jars
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Click below to sign up and get $200 of credit to try our products over 60 days!
Today because of this article I could fix the issue after JDK got upgraded to JDK11 in my project . Thanks a lot for this step by step guide. I am so grateful for this .
I import all Jar files into my project refrenecs but still i am getting error when trying to import in the project “import org.openqa.selenium.Webdriver;” The error in the test class is saying The package org.openqa.selenium is not accessible
Thanks so much for step by step help which resolved my selenium configuration issue.
I have installed newer version of Java, Eclipse. Have done exactly the same posted here, still unable to understand what value should be entered in “System.setProperty(key, value)” as I am unable to find the path to chrome or firefox driver. Please help me with this issue. I have installed Eclipse IDE for Java Developers Version: 2019-12 (4.14.0) on my Windows 10 64-Bit system with Java version 8 update 251(build 1.8.0_251-b08) Please help
Thanks. It is a very helpful guide.
Thanks for sharing the information. After following each and very step, I’m getting error : org.openqa.selenium.WebDriver is never used. org.openqa.selenium.firefox.FirefoxDriver is never used. Please help me.
This is wonderful guide to setup selenium. Thanks from bottom of my heart…
Thank You All.
- Vinod Reddy
Thanks for step by step configuration maven project
Thanks for step by step configuration of Selenium