Nowadays, hundreds of web applications are being built every day. All these applications require some sort of QA testing to perform well. This is where the Selenium suite comes in.

Selenium is an open-source portable testing framework for web applications. Selenium test scripts can be written in different programming languages like python, c++, java, etc. It is a very flexible testing framework for testing functional and regression test cases.

These scripts can be run in most browsers like chrome, safari, firefox, opera, etc., and on platforms like mac0s, windows, and Linux. It supports cross browsing as well as testing on different platforms simultaneously.

The Selenium Suite

Selenium is not just a single app. It contains a suite of tools that work together to provide a good testing experience. The Selenium suite includes:

  • Selenium IDE
  • Selenium RC
  • Selenium WebDriver
  • Selenium Grid

Selenium IDE

IDE (Integrated Development Environment) is a Firefox plugin. It is primarily a run tool used by test developers to develop Selenium Test cases. It allows the tester to record and playback scripts. To create scripts using Selenium IDE, you must use Selenium RC or WebDriver to write advanced test cases.

Selenium RC

Selenium RC, also known as Selenium 1, was the first and most popular selenium product used to write test cases. It mainly uses JavaScript for automation but also supports Ruby, C++, PHP, Python, Perl, etc. Nowadays, it is not used as much and has been mostly deprecated. However, it can be used complementary to WebDriver for maximum effect.

Selenium WebDriver

Selenium WebDriver is what superseded Selenium RC. It is an important member of the Selenium family. It is a browser automation framework which accepts commands and sends them to the browser. The Selenium WebDriver directly communicates with the browser and controls its activities.

As we know, Selenium is not an independent tool. It is a collection of tools that make the Selenium suite, which was created when Selenium RC and WebDriver were merged. It also shares support for various programming languages like Python, PHP, Java, Ruby, C#, JavaScript etc.

Selenium Grid

Selenium Grid is a smart proxy server used along with Selenium RC. It is used to run testing on different machines on browsers simultaneously. Collectively, it allows multiple testing against different machines simultaneously in different browsers.

Selenium WebDriver Architecture

The Selenium WebDriver cannot be used well without its supporting architecture. We must know about the WebDriver API to understand the Selenium WebDriver Architecture.

The Selenium WebDriver Architecture is a set of open-source APIs that helps communicate between languages and modern web browsers. The architecture consists of four main components, which are:

  1. Selenium Client Library
  2. JSON WIRE PROTOCOL over HTTP Client
  3. Browsers Drivers
  4. Browsers

Now let's understand each component in detail.

Selenium Client Libraries/Language Bindings

Software testers prefer languages they are comfortable with, and Selenium WebDriver Architecture supports multiple libraries such as Java, C#, Python, Ruby etc. So, specific language bindings are available for anyone with knowledge of any programming language.

JSON WIRE PROTOCOL over HTTP Client

JSON stands for JavaScript Object Notation. The JSON Wire Protocol transfers data between a server and a client on the web. This is also called the heart of Selenium. JSON Wire protocol is a REST API that transfers the information between HTTP servers of each Browser Driver.

Browser Drivers

Selenium supports various browsers, each with a separate browser driver. The browser driver communicates with the respective browser and hides the implementation logic from the end-user.

Browsers

Selenium can run tests on multiple browsers such as Firefox, Chrome, Safari etc. The range of browser support is dependent upon this API.

Example Demo

Let's go over a demo case of using Selenium.

In real-time, you can write code in your UI using any of the supported Selenium client libraries. For example, to create an instance of the Firefox driver, we can use the following commands:

Import org.openqa.selenium.WebDriver;
Import org.openqa.selenium.firefox.FirefoxDriver;
WebDriver driver = new FirefoxDriver();
Instantiating Firefox Driver

Once you are ready with your test automation scripts, you can click on Run to execute your scripts.

Congratulations, you just tested an app in Firefox using Selenium!

So, that was all about Selenium WebDriver Architecture. Don't forget to click on the subscribe buttons below to stay updated with our latest blogs!