Home >>Selenium Tutorial >Selenium WebDriver

Selenium WebDriver

Selenium WebDriver

Selenium WebDriver is a key component of the Selenium Tool Suite. The latest release "Selenium 2.0" is integrated with WebDriver API providing a simpler and more concise interface for programming.

The image below will give you a good understanding of the Selenium components and the Test Automation Tools.

Selenium WebDriver

Selenium WebDriver was implemented as a feature of Selenium v2.0. The original Selenium i.e. Selenium v1 variant consisted of just IDE, RC and Grid. With the release of Selenium v3, however, RC was deprecated and moved to a legacy package.

Test scripts can be created in WebDriver using any of the programming languages available, and can be executed directly in most modern web browsers. WebDriver-supported languages include C #, Java , Perl, PHP, Python , and Ruby.

Until studying the Selenium WebDriver principles, you will be well versed in some of the programming languages that are supported. Selenium Web driver is currently the most popular driver among Java and C #. We use Selenium with java for that tutorial.

Selenium WebDriver is much quicker than Selenium RC, as it allows direct calls to the web browsers. RC on the other hand needs an RC server for browser interaction.

WebDriver has built in Firefox driver (Gecko Driver) implementation. For other browsers, to communicate and run the test, you must plug in their browser-specific drivers. Most frequently used WebDriver include:

  • Google Chrome Driver
  • Internet Explorer Driver
  • Safari DriverOpera Driver
  • HTML Unit Driver (a special headless driver)

Selenium WebDriver- Architecture

Selenium WebDriver API enables simplified communication between languages and browsers.

The image below displays the WebDriver selenium architectural illustration.

Selenium WebDriver

There are four basic components of WebDriver Architecture:

  • Selenium Language Bindings
  • JSON Wire Protocol
  • Browser Drivers
  • Real Browsers

Selenium Language Bindings / Selenium Client Libraries

To help growing languages, selenium developers have developed language bindings/Selenium Server Libraries. If you choose to use the application driver in java for example, use the java bindings. All language bundles that are enabled can be downloaded from the official Selenium website (https://www.seleniumhq.org/download/#client-drivers).

JSON Wire Protocol

JSON (JavaScript Object Notation) is an open standard for web-based data exchange. It supports structures in the data such as object and array. So, JSON data is easy to write and read.

JSON Wire Protocol offers a method for data transfer between a server and a client. JSON Wire Protocol serves as an industry standard for various REST network services

Browser Drivers

Selenium uses drivers, unique to each browser, to establish a secure user link without exposing the internal logic of browser features. The application driver is also unique to programming language such as Java , C # 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 request via HTTP server.
  • HTTP Server agrees on all the actions that are performed on the server to follow orders.
  • The execution status is transferred to HTTP Server and is then returned to the script for automation.

Browsers

Browsers supported by Selenium WebDriver:

  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari

Selenium WebDriver- Features

Some among Selenium WebDriver's most significant features are:

Selenium WebDriver

WebDriver also allows testers to use dynamic finders to address complex types of web elements such as checkboxes, drop-downs and alerts.

  • Various Browser Support: Selenium WebDriver allows a range of web browsers including Firefox , Chrome, Internet Explorer, Opera and many more. This also supports some of the unusual or uncommon browsers like HTMLUnit.
  • Support for multiple languages: WebDriver also supports most commonly used programming languages, such as Java , C #, JavaScript, PHP , Ruby, Pearl and Python. Thus the user can select any of the programming language sponsored based on his / her competency and start creating the test scripts.
  • Speed: WebDriver executes faster than other Selenium Suite tools. Like RC, no intermediary server is needed to interact with the user; the tool interacts directly with the browser, instead.
  • Simple Commands: Most of the commands used in Selenium WebDriver are easy to implement. For instance, to launch a browser in WebDriver following commands are used:
    1. WebDriver driver = new FirefoxDriver(); (Firefox browser )
    2. WebDriver driver = new ChromeDriver(); (Chrome browser)
    3. WebDriver driver = new InternetExplorerDriver(); (Internet Explorer browser)
  • WebDriver-Techniques and Classes: WebDriver offers various approaches to tackle certain possible software research problems.

Selenium WebDriver


No Sidebar ads