Download Selenium and JUnit jar files

Welcome to this article in our Selenium WebDriver Tutorial series. This article is a part of our Selenium webdriver setup, and here you will learn how to download Selenium Webdriver and JUnit jar files.

Before we begin with the download process, let us have a quick look as to why we need to download selenium and junit jar files.

Why do we need to download Selenium jar files?

When you try to automate your test scripts with Selenium, you will have to perform multiple actions on the browser. Some examples of these actions are opening URL on a browser, clicking on some button or link, entering some data in a text box, selecting from a drop down field etc.

All these actions are provided to us by various selenium libraries in the form of selenium jar files. So, we need to download selenium webdriver jar files and use it in our project.

Why we need JUnit jar file?

JUnit is a unit testing framework for Java. JUnit is not related to selenium in any way. It just helps you to write test cases in a more structured and better format.

You can use both junit and selenium independent of each other. However, combining these together helps write test cases in a much better format. You will see how this works when we actually come to the coding part.

Why download the jar files instead of using Maven?

You might think as to why we are downloading these jar files instead of just using maven to set the dependencies? Even though maven is much easier to setup, it has its own learning curve and it sometimes leads to confusion.

Due to this, we suggest that a better approach for beginners is to first setup selenium by directly downloading the jars and writing one or two selenium scripts. This will give you good confidence that the selenium setup works fine.

After this, you can easily convert your existing project to a maven project. So even if you get some issues at this stage, you will know that its related to maven setup and not with selenium. This way it’s much easier to learn selenium automation, one step at a time.

Let us now start with the download process.

Download selenium webdriver jar files

Follow the steps given below to download the latest version of Selenium webdriver jar files from selenium official website –

1. Open Selenium download page using this link – https://www.selenium.dev/downloads/

2. Scroll down a bit on the page. You will see a section called Selenium Client & WebDriver Language Bindings. Here you will see download links next to different languages such as Java, C#, Ruby etc. Since we are using Java with Selenium in this tutorial, you will need to download Java specific drivers. To do so, click on the link next to “Stable:” text

3. Selenium webdriver jar files would start downloading. The file size is around 28.5 MB

4. Once the file is downloaded, unzip it. We are using 7-zip to extract the files, but you can use any extractor of your choice

5. Open the unzipped folder. It would look something like this. The jar file names might change depending on the version you are downloading. Generally speaking, you should find a lib folder and few other jar files in the selenium folder. You would also see some other files such as LICENSE, NOTICE etc.

To work with selenium, you would need to use all these jar files, i.e., all the jar files inside libs folder and the jar files in the main selenium folder as well. With this, we have completed the download process of the latest version of Selenium Webdriver. Let us now download the junit jar file.

Note: In the above screenshot from selenium-java-x.x.x folder, you would have noticed that there is a jar file for selenium-chromedriver. Similarly, if you scroll down a bit, you will see that there are selenium driver jar files for selenium-edge-driver, selenium-firefox-driver, selenium-ie-driver and selenium-safari-driver as well.

This means that if you are using the latest version of Selenium Webdriver, you would not need to download chromedriver or any other specific browser driver separately. All of it now comes packaged with the webdriver !!

Download junit jar file

Unlike selenium webdriver jars, there is only one jar file that you need to download for junit (from maven repository). Follow the steps given below to download the junit jar –

1. Open junit maven repository using this link – https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api

2. Click on the link for the latest stable version (5.10.0 as per this image)

3. Click on the jar link to download the jar file

3. Save the JUnit jar file on your machine

With this, we have now downloaded both selenium webdriver and junit jar files. The next step is to download chrome driver which you will need to run your tests on Chrome browser. (As mentioned previously in this article, chromedriver and other browser drivers come packaged with the latest selenium webdriver version, so you don’t need to download it separately). Head over to our Selenium Webdriver Tutorial main page, where you will learn about setting up Selenium project in Eclipse.

If you have any queries on this article, or any other feedback for us, then please feel free to contact us using comments section.