Introduction to Selenium
For working on Selenium, firstly, we need to install the three main items: Eclipse for Integrated Development Environment(IDE), advanced version of Java Development Kit (JDK), and obviously the Selenium jar package. Then Open Eclipse and load the Selenium Jar files for including API classes from Selenium Library files. Now, create a new java project under the latest JDK, which lands on the Project workspace. The next step is to create a new package and class under the previously created source, name the package and class, choose the main method, interfaces, access modifiers, etc., and finally click on the build path followed by configure build path to load the external selenium jar.
How 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.
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 the 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, the 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, the 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.selenium.dev/downloads/ 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. These 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 the Java programming language of client version 18.104.22.168 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, create a new project, and load the above jars into the Project Build Path 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 an 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 discuss an introduction to Selenium along with different steps to install Selenium in our windows. You may also look at the following articles to learn more –