Now, let's get into what Selenium WebDriver is.
The biggest change in Selenium recently has been the
inclusion of the WebDriver API.
What does it do?
It drives the browser natively, just as a user would,
either locally or on a remote machine using the Selenium server,
marking a leap forward in terms of browser automation.
WebDriver is designed to provide a simpler,
more concise programming interface,
in addition to addressing some limitations in the Selenium RC API.
Selenium WebDriver fits in the same role as RC did and has
incorporated the original 1.x bindings.
It drives the browser much more effectively and
overcomes the limitations of Selenium 1.x,
which affected our functional test coverage,
like the file upload or download, popups,
and dialog style.
It refers to both the language bindings and the
implementations the individual browser controlling code.
This is commonly referred to as just WebDriver, or sometimes Selenium 2.
So essentially Selenium 1.0 plus WebDriver is Selenium 2.0.
Selenium WebDriver was developed to better support dynamic
web pages where elements for page maybe change without the
page itself being reloaded.
And based on your browser, it has many classes to choose from,
such as the Chrome driver, Firefox driver,
Safari driver, etc.
Here is a diagram showing the architecture
representation of the Selenium WebDriver.
It has four basic components, the Selenium language bindings,
JSON wire protocol, browser drivers, and real browsers.
Selenium developers have built language bindings as Selenium client
libraries in order to support multiple languages.
For instance, if you want to use the browser driver in Java,
use the Java bindings.
All the supported language bindings can be downloaded
from the official website of Selenium.
JSON, a JavaScript object notation,
is an open standard for exchanging data on web.
It supports data structures like object and array.
JSON wire protocol provides a transport mechanism to
transfer data between a server and a client.
Selenium uses drivers specific to each browser in order to establish
a secure connection with the browser without revealing the internal
logic of the browser's functionality.
The browser driver is also specific to the language used for automation,
such as Java, Python, etc.
When we execute a test script using WebDriver,
the following operations are performed internally.
HTTP request is generated and sent to the browser
driver for each Selenium command.
The driver receives the HTTP request through the HTTP server.
The server decides all the steps to perform instructions,
which are executed on the browser.
Execution status is sent back to the HTTP server,
which is subsequently sent back to automation script.