How to Install Selenium?
This article is based on how to install and use the Selenium framework using Java Programming language and Eclipse IDE. Selenium is a test automation framework used for testing web applications. Selenium was purely written in Java Programming Languages.
Below are the pre-requisites required for installing Selenium framework on Windows operating system.
- JDK latest version installed on Windows
- Eclipse IDE
- Selenium Jars
The JDK version chosen in this training is JDK 8+ which is sufficient to work with Selenium framework in order to facilitate the Test Automation run time environment.
The JDK is a Java Development Kit library which is used primarily for the development purposes of Java application. JDK contains JRE (Java Runtime Library) and JVM (Java Virtual Machine) run time environment. Eclipse is an IDE (Integrated Development Environment) which is used to develop Java applications particularly to develop the basic or enterprise applications. This will enable to add jars and manage the life cycle of the java project. This will also enable the developer to add several plugins and build automation tools to develop the projects.
Steps to Install Selenium:
Let us discuss the steps required to install Selenium.
Step 1: Install JDK by downloading the JDK zip file or .exe file from the Oracle official website.
The URL for the official website is as below:
Installation of JDK is a minimum requirement to install the Selenium. The Selenium jars can be added to the project which is on top of the existing Java runtime library.
4.5 (2,664 ratings)
Step 2: The Java development kit can be downloaded from the official website which is free of cost as it is open source and can be used by anyone. Click on the Download button as shown in below figure. After downloading the file it needs to be installed using the Windows Program Installer.
Step 3: After clicking the Download button, select Accept License Agreement and then select the respective operating system (Windows in this case) either for a .exe file or .zip file. Accepting the License Agreement is mandatory to proceed with the download option for different versions of libraries for different operating systems.
Step 4: After downloading the above file, install the program and the below window appears. Click Next as shown in the below installation window.
Step 5: After clicking Next, below windows appears. The options available can be left to default without making any other changes.
Step 6: Again, click Next > then the below installation status window appears. It takes a few seconds in order to complete the installation process.
Step 7: Once the installation completes, below window appears with the success message showing as below
Step 8: Click on Close, the installation is finished and the installed directory can be checked from the C Drive and the JDK-11.0.2 folder can be seen as below. After installation, the JDK folder will be created in the C Drive as mentioned during the installation time which was by default. This drive location or installation location can be changed upon requirement during the installation time itself.
Step 9: Now download the Selenium Jars from the Selenium official website https://www.seleniumhq.org/download/ as shown below: The below is the official website of the Selenium Software. There are different client versions and releases available for different languages which support the usage of Selenium with cross-platform applications. This will be the Selenium framework related libraries with many types of applications to work with.
Step 10: Click on the Download button as shown above for the Java related Selenium jars. The above-selected option is for Java programming language of client version 184.108.40.206 for the mentioned release date. The respective Javadoc can be found to the right side of the Download button
Step 11: After downloading the above Jars, open the Eclipse IDE and create a new project and load the above jars into the Project Build Path in order to use the API classes from the Selenium library.
Step 12: Click on File Menu and Select New and then select Project. This option will give the developer to create the new project in the particular workspace which was chosen while opening the Eclipse IDE or the workspace can be changed later based upon the requirement and then the below window appears
Step 13: Select Java Project and then click Next > now the below window appears. This option will enable the user to create a Java project specifically.
Step 14: Enter the Project Name and latest JDK (Java Development Kit) version, the JDK version can be of JDK 8.0 or above and click Next > as shown in the below picture. Any other latest JDK version can also be selected based upon the requirement and the functionalities required to develop in the project.
Step 15: The below window appears after clicking the Next button as below:
Step 16: Now click finish in order to complete the project creation. Now the Project structure with empty source folder named src. Now create a new package and new Class under the source folder as shown below
Step 17: Now the below window appears, enter the package name and class name and then click Finish to create. There are also other options to choose Access Modifiers, Interfaces to Add and other stubs to create the main method, constructors or inherited abstract methods by default while creating the Class itself.
Step 18: Now the Project setup is ready and the Jars can be loaded to Build Path to install Selenium.
Step 19: Now right click on the Project and select Build Path and then select Configure Build Path option under the Build Path options as shown below:
Step 20: Now the below window appears as shown below:
Step 21: Now click on libraries tab and then click on Add External Jars to add the Selenium jars into the Project Build Path. Now the window appears as below
Step 22: The above Jars are available within the Selenium Jars folder. The other Jars whichever are needed can also be added to the Build Path which supports any other libraries.
Step 23: Now the remaining code development can be carried out in the Project as per the business requirement.
This has been a guide on how to Install Selenium. Here we have discussed different steps to Install Selenium in our windows. You may also look at the following articles to learn more –