In our last guide, we discussed the basic architecture and functionalities of WebDriver. This is the 9th instalment in the Selenium Tutorial Series.
This guide will explain the procedure of installing and configuring WebDriver from its initial stages. We will also look at the various drivers provided by WebDriver, which are built for different testing situations and environments.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
To use WebDriver for scripting, certain prerequisites such as an essential environment setup must be met. Throughout this series, we will utilize Java as our programming language for the examples. Therefore, let’s commence by installing Java.
Topics Covered:
Java Installation
Step 1: Access the official website of Oracle – “JAVA Download“, and retrieve Java Platform, Standard Edition. You can find the latest releases on the page.
Step 2: After clicking on the Download icon, you will encounter the following screen. Accept the License agreement and select the suitable Java Development Kit (JDK) from the options based on your system’s specifications.
Remain aware that you should download JDK (Java Development Kit) since it already includes the JRE (Java Runtime Environment). There is no separate installation needed for JRE.
Eclipse IDE Installation
Step 1: Visit the official site of Eclipse and go to the download page – Eclipse Download. You will find there all the latest releases.
Remember to select and download the suitable Eclipse IDE for Java EE developers in accordance with your system’s specifications. Separate download links are provided for 64-bit and 32-bit Windows OS.
Step 2: Once you click on the download link, you will be directed to a page detailing the current download. To continue, click the download icon.
Wait for a few minutes for the entire zip folder to be downloaded.
Step 3: When the download completes, make a copy of the folder and keep it in your chosen location on the file system.
Step 4: Unzip the folder to locate the “eclipse” folder, where all the necessary application and resource files are stored.
Step 5: Initiate the Eclipse IDE by running “eclipse.exe” from the “eclipse” folder. You can refer to the above image for guidance.
Step 6: The application will ask you to mention the workspace location. This location is where all your Eclipse projects will be stored. Insert/browse your chosen location or use the default option, then click the OK button.
Configuring WebDriver
Because Java is our chosen programming language for this series and we need to develop test scripts in Java, it is crucial to download the language-specific client drivers. We will begin this process by getting the Selenium Java Client Libraries.
Retrieving Selenium Java Client Libraries
Step 1: Access Selenium’s authoritative site and navigate to the download page – “http://docs.seleniumhq.org/download/”. Locate the section that lists the Client Libraries accessible for different programming languages. Click on the download option for the Java Client Library.
Wait for a few minutes until the entire zipped folder is downloaded.
Step 2: Upon download completion, copy the folder and place it in your chosen location on the file system.
Step 3: Unpack the zipped folder to uncover the folder named “Selenium-2.41.0.zip”. This folder holds all the necessary jar files needed for creating test scripts in Java.
These libraries can then be set up in the Eclipse IDE.
Configuring Libraries with Eclipse IDE
Step 1: Launch Eclipse IDE. Start a new Java project by clicking on File -> New -> Java Project. Refer to the image below for guidance.
Step 2: Name your Java Project. Let’s call it “Learning_Selenium” and click the Finish button. The newly created project will appear on the left side of the screen on the package explorer panel.
Step 3: Form a new Java class named “First_WebdriverClass” under the source folder by right-clicking on it and navigating to New -> Class.
Step 4: Now we have to configure the libraries in our Java project. Right-click on the project, select “Properties” from the drop-down menu, and opt for “Java Build Path” from the subsequent screen.
Step 5: The “Libraries” tab will open up by default. If not, then click on the “Libraries” tab. Next, click on the “Add External Jars…” button. Navigate to the spot where you saved the extracted folder for Java Client Libraries.
Step 6: Choose all the JAR files in the “selenium-java-2.41.0” folder and click the Open button in the dialog box. The properties dialog box should look like the below image.
Step 7: Click on the “OK” button in the dialog box to finalize configuring the Selenium Libraries in our Java project.
Your project should now resemble the image below:
Available Drivers
WebDriver offers an array of driver classes, each engineered specifically for a certain web browser. Each browser has its unique driver implementation in WebDriver.
While automating some browsers is directly possible in WebDriver, others need an external unit known as a Driver Server to execute and automate test scripts. To leverage different web browsers, the user has to download the related Driver Server.
Keep in mind that each web browser comes with a dedicated Driver Server, and a Driver Server will not function with browsers it is not engineered for.
Here are the available web browsers and their corresponding Server Drivers.