What is selenium WebDriver - Introduction, Architecture, Set up, Advantages and Disadvantages
When it comes to web automation testing, there are several
frameworks like Selenium, TestNG, Cypress etc., Test automation framework is decided
by using parameters like type, complexity, along with the framework expertise
available within the team. However, Selenium is the most preferred framework
among all the test automation frameworks
For starters, Selenium WebDriver is the
core of the Selenium automation framework. In this Selenium WebDriver chapter, I am
going into the integral views of Selenium WebDriver as well as we will learn
selenium architecture and basic understanding of it.
At the end of this chapter, you will get to learn about basics of selenium and framework of selenium WebDriver
So, let us get started
![Selenium Logo Selenium Logo](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1Nswyw9qOi-oII_I-qsR0LEi-XdRuqysbyEmdQ34IYAwbEhxd2lFbJrb1f4muyDqTGeHS1YSgWTUNlPwxZsRg0Xy_vdH_3IqsB_Ee3VO16TFM1t9psJRb9WigTLyD-H539vV1sW1Y9S60zGA2RSd30lSx3mfxegBWxXHlF9FKLuZu6Prf9lCbsQu9iQ/w463-h205/Selenium_Logo.jpg)
Selenium
is one of the widely used open-source Web UI (User Interface) automation
testing frameworks. It enables Software Engineer’s to execute tests on different
browsers, platforms, and computer languages.
During
my QA career, I have the fortune to try out and use several test automation
frameworks. No any frameworks come close to the Selenium automation framework
in terms of framework features, supported languages, CI/CD integrations, easy
to understand and more. Nevertheless, Selenium automation testing is still the
most preferred mode for realizing web automation testing.
One
of the major advantages of Selenium WebDriver over other test automation
frameworks, is it supports all popular programming languages like Python, Java,
JavaScript, C# etc.
![Selenium Language Selenium Language](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrpZohhXEofgpDsSxR7YmVnEUymUe2MGB6_SAPfzqgLVMCnftXReMoDvHnW6edDx--q5CIQtKJ3FbOmDYNAfYKhtWm_AmMwHiU9lp47u9lJYSO0FGzxMugwsjVCPHLPx1J5f2XFdk99O2JXc4DicstM6Lz4_DzR6t1mSppE_GjCir47t1mdGhEfIoyuQ/w389-h252/Selenium_Lang.png)
What is WebDriver?
WebDriver
is one of the types of the whole Selenium framework that helps in overall browser-based
test automation. WebDriver is the remote-control interface component that
allows programs to interact and tells browsers, manipulate DOM elements in a
web document, and control the behavior of the User Agent. WebDriver’s is
language neutral protocols, i.e., protocols that is independent, is leveraged
by Selenium framework to automate testing steps. So, in nutshell WebDriver is
the connection between the Selenium framework and the end browser over which
the test is being executed.
Now
a days Selenium and WebDriver are usually spoken together and are even used
interchangeably to identify the same framework, Selenium WebDriver. But that
has not been the case always. At the starting Selenium and WebDriver were
separate open source projects, however in 2008 both teams came together and eliminate
inherent issues of then Selenium RC version.
Following
is the evolution of the Selenium automation framework:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgswFDzTEhSQKZvygij9vXleSYKfsBQ_mGMLt6Q_pfMOpwuMyD6TpOscK6yZ79yrwpF0pKfKXdz6uNZok1mL_0YnXkMLNoV3R0GbXXiOGPs4nqQKKnttDqEHXhq7LU1X8oFvoXeCd9w1QaaQp9FFJlX82xnQlSMFW8r9zqIj4b_GxGgFkFAx6BhrVkbqg/w412-h285/Selenium_types.jpg)
Advantages of
Selenium automation framework
Now that we have gone through basics about what is selenium, now let’s discuss some major advantages of the Selenium automation framework in this section of the Selenium WebDriver chapter:
- Selenium supports multiple programming languages like Java, Python, C#, JavaScript, Ruby, PHP, etc.
- Selenium is also a platform-independent. So, script written on windows will work on macOS
- Selenium tests can be executed across various browsers (e.g., Firefox, Chrome, IE, Safari, etc.) and different operating systems (e.g., Windows 10, macOS, etc.).
- Parallel testing using the Selenium helps achieve improved browser and test coverage. This eventually helps in reducing the time of execution.
- Selenium and Continuous Integration lets testers run Selenium automation tests as a part of the CI/CD pipeline by using Jenkins pine line
- We can integrate selenium with Extent and Allure for reporting purpose. So that we can get customized report which is very useful for analysis
·
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8gwMmpjmzOGl3cYaGZWUfn3I4xTBzWDcsKbuaMeMoTVQtK3O3RFhTk5omN6chOFOfkVCRM9WHzZkM8G_NC7O82UP8ijct8GVes47-IDYXrK9cOjTE56mjhYS-NzfCziyye0zqlhflfZR1JxMYEkTLe3CMXD_j05vPp2qJe82CTPhl2_DvM9l89CHiew/w400-h212/Selenium_Advantages.png)
Disadvantages of
Selenium WebDriver
The advantages of selenium WebDriver outnumber its disadvantages.
However, as a tester, it is important to make an informed choice before
choosing the best-suited framework for the project.
Below are some of the disadvantages of Selenium WebDriver:
- We cannot write scripts for Windows-based applications.
- It does not have any in-built reporting mechanism and hence we must integrate separately.
- No test tool integration for test management in Selenium.
- We cannot automate scenarios like OTP and file uploading using selenium.
However, these drawbacks are nothing compared to its advantages
Selenium WebDriver Download, Installation and Set Up
In this Selenium WebDriver section, we will be using the Windows OS with Java as the programming language and Eclipse as the IDE (Integrated Development Environment). Starting off with the prerequisites:
- Install Java
- Install Eclipse IDE
- Install Selenium WebDriver
Install Java
You need to follow the steps below, to download Java in your system.
Step 1: Go to the official Java Download Website and download latest version of the the JDK for Windows x64 Installer.
Step 2: Accept the license agreement in the pop-up and click on Download.
Step 3: Once the download is completed, go to Downloads folder, and double click the executable so that Java is installed in your system.
Set Up Environment Variables
Once the installation is done you need to set the Environment Variables using the below steps-
Step 1: Open your system’s settings and select Advanced System Settings from the System dialog window.
Step 2: Click on the Environment Variables button on the next window.
Step 3: Now under the System Variables double click on Path.
Step 4: Add the complete path of the Java installation directory as per your system location and click OK.
To confirm that the java is installed and variables are set correctly, open Command Prompt and run command: java -version. You can see the java version installed in your system.
Your first prerequisite is fulfilled. Now we will go through how to install eClips IDE.
Install Eclipse
Step 1: Go and download Eclipse IDE from the Official Eclipse website. Select the download location on your system architecture.
Step 2: Once the download is done, extract the zip file at a location as per your requirements.
Step 3: Next open the extracted folder and double click on eclipse.exe.
The eclipse will open, close the welcoming window. We will configure it letter. So, we have downloaded our second prerequisite.
Download Selenium WebDriver and Set Up
The next and last step is to install the Selenium Standalone Server which is explained in the steps below-
Step 1: Go to the Official Selenium Website.
Step 2: You will be able to see a section for Selenium Client & WebDriver Language Bindings. You can download the client libraries corresponding to your language preference. We will be working with Java Client Bindings in this section.
Step 3: Once the file is downloaded, extract it to a folder so that you can use it later.
Step 4: You can now see the corresponding extracted file in the selected destination folder.
Step 5: Open the folder and you will be able to see the jar files, a libs folder(which contains some more jar files) and a Change log file.
Step 6: Next, you must download the browser drivers that will help you start the browser. You can download drivers from google.
Step 7: Keep browser drivers in specific locations so use it while executing scripts.
In this Selenium WebDriver chapter, we have deep-dived into the basics of Selenium WebDriver, its components, Selenium advantages and disadvantages and configuration of selenium
Happy Learning.
Comments
Post a Comment