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
If you’ve enjoyed this tutorial and our broader community, consider checking out our DigitalOcean products which can also help you achieve your development goals.