What Is And Why Do We Need Selenium Framework?

What Is And Why Do We Need Selenium Framework?
Wille Kreutzman
  July 18, 2019

As one of the most widely used test automation frameworks in the world, Selenium is definitely a popular test framework suite for automating web browser testing. Today we are opening a new blog series circling around the topic of the Selenium framework and browser testing.

What is Selenium Framework?

So, what actually is the Selenium framework? Simply put, Selenium is a popular automation testing suite which can be used to automate the desktop and mobile web browser interactions. You can perform automation testing by writing code in any of your preferred language supported by Selenium and can easily run your automation scripts to automate testing of an application or a process.

There is more to this than meets the eye. Selenium is not only one framework but rather a set of frameworks bundled into a suite. A toolbox to make the life of a software tester that much easier. It is an essential part when creating robust, browser-based regression automation suites and tests.

When people think of Selenium, they probably think of the Selenium WebDriver, which is understandable as it is the most used tool in the suite. But to fully utilize Selenium and choose the correct tool for the job, it is good to know what parts make up the popular testing system.

Below we will go through the tools in more detail, but the emphasis will lie mostly on the Selenium WebDriver or Selenium 3, if you will, as it is the key interface when driving a browser.

Selenium Suite Makeup
Selenium IDE

The Selenium Integrated Development Environment is only available for two browsers, for Chrome and Firefox. This extension makes it easy to record and playback tests in the browser. The recorded script can also be viewed and changed into other languages. But to write more advanced and robust test cases Selenium RC or WebDriver is recommended.

Selenium RC (Remote Control)

Selenium RC is a client/server system that allows you to control web browsers locally or on other computers, using almost any programming language and testing framework. There are many tools and versions out there and they can get confusing so in short Selenium RC can be seen as Selenium 1, then RC merged with WebDriver making Selenium 2.0 and then Selenium 3 is an improvement on Selenium 2. Therefore, the successor to Selenium RC is the Selenium WebDriver.

Selenium Grid

With Selenium Grid, you can run parallel test sessions by running many servers at the same time with a Hub and Node Architecture. One could look at it as a scaled-up Selenium Remote Control. Selenium Grid also supports RC and WebDriver scripts. These scripts will be communicated via the Hubs out to the Nodes and then executed.

Selenium WebDriver

Selenium WebDriver is a browser-specific driver which helps in accessing and launching the different browsers whether it’s desktop browsers or mobile browsers. That means it does not support for example Windows applications. It provides an interface to write and run automation scripts. Every browser has different drivers to run tests.

Chrome has ChromeDriver, Firefox has GeckoDriver, Safari has SafariDriver and so on, due to the fact that every browser has a different way of performing actions i.e. loading a page.

WebDriver has the capability to test modern and dynamic websites, sites where content is changing dynamically with a click of a button for example. As you will find out later when we go through the architecture, it works by interacting with the browser in more or less the same way as a real user would.

The Selenium WebDriver architecture works in the following way. You write your tests in your preferred programming language, this is communicated in JSON over HTTP (REST API) to the browser-specific driver which then, in turn, instantiate and communicates via HTTP to the browser itself and the browser communicates back with an HTTP response.

Selenium WebDriver Architecture

Therefore it does not matter what language you use as Selenium communicates with the Client Library and the Browser Driver will then handle the specific actions.

Later in the series, we will go through how we set up the Selenium server and WebDriver to be able to run our tests.

Why Use Selenium Framework for Automated Browser Testing?

As we now are familiar with the makeup of Selenium and the tools at hand, let’s take a look at the main points or benefits of Selenium and why it is a good tool for automation testing:

  • Open Source: Selenium is open source, this means that no licensing or cost is required, it is totally free to download and use. This is not the case for many other automation tools out there.
  • Mimic User Actions: As stated earlier, Selenium WebDriver is able to mimic user input, in real scenarios, you are able to automate events like key presses, mouse clicks, drag and drop, click and hold, selecting and much more.
  • Easy Implementation: Selenium WebDriver is known for being a user-friendly automation tool. Selenium being Open Source means that users are able to develop extensions for their own needs.
  • Tool for every scenario: As mentioned earlier, Selenium is a suite of tools, and you will most likely find something that fits your scenario and your way of working.
  • Language Support: One big benefit is multilingual support. Selenium supports all major languages like Java, JavaScript, Python, Ruby, C sharp, Perl, .Net and PHP, giving the developer a lot of freedom and flexibility.
  • Browser, Operating System & Device support: Selenium supports many different browsers Chrome, Firefox, Opera, Internet Explorer, Edge, and Safari as well as operating systems (Windows, Linux, Mac)
  • Framework Support: Selenium also supports a multitude of frameworks like Maven, Junit, TestNG to make it easier to automate testing. CI and CD tools like Jenkins is also supported, for automating the deployment process.
  • Reusability: Scripts written for WebDriver is cross-browser compatible. Testers can therefore run multiple testing scenarios with the same base.
  • Community Support: The Selenium community is quite active and open. Therefore, there is a lot of information and help available when needed.
  • Advanced User Input: With WebDriver it is possible to request clicking of the browser back and front buttons. A practical feature when testing money transfer applications for example. This feature is not found in many tools, especially open source.

You Might Also Like