Selenium Components for Web Test Automation

Selenium is the most used browser automation tool till date. It doesn’t matter if you are a fresher or an experienced test engineer, you can learn the basics of Selenium framework. It is available as an open source so you can use it without paying any dime. Nowadays, Selenium is apparently the best choice for doing automated testing of Websites. It is steadily gaining popularity, and becoming a benchmark tool for the testers as well as for the organisations which are automating the functional testing of their Web applications. Not only test engineers, but the developers can also use it for the unit testing of their projects. In this post, we’ll exclusively talk about the various Selenium components and the browser plugins that you should be using with it.

Before you begin your dwell with Selenium, it is fair to know a brief history of this technology. It was Jason Huggins in 2004 who first created the Selenium while working at ThoughtWorks. He was the engineer who conceived the idea of browser automation to ease the repetitive tasks of manual testing. He gave this component its first name as the “JavaScriptTestRunner”. Then there was another bright engineer working at the same office, Paul Hammant, who extended its functionality and described it as Selenium RC. Afterwards, there came many innovators likes of Patrick Lightbody, Shinya Kasatani, and Simon Stewart, who contributed immensely to the development of Selenium technology. Lately, it was Simon Stewart who transformed the Selenium into Webdriver making it simpler, faster and more efficient.

While you start learning Selenium, you must know that it is a collection of tools that make it a perfect fit for Web UI automation. At the core, it has Selenium RC and Webdriver interfaces where you can plug-in different browser drivers like the Internet Explorer and Chrome to support cross-browser testing. However, some external tools like the Eclipse and Selenium IDE help you creating/writing automation scripts. Moreover, there are a bunch of supporting browser add-ons like the FireBug and FirePath that further eases up the UI automation process.

You can begin your journey by start using the Selenium IDE, which comes as a FireFox add-on. Subsequently, you can learn the different techniques to work with the web element locators. Locators are the unique identifier for accessing the HTML objects on a web page. Side-by-side you should try automating the workflows of any website such as booking tickets from a travel portal using the Selenium IDE. It’ll not only help you memorise the concepts you’ve learned, but you will absorb faster with this approach.

  1. Visualize the Selenium Webdriver Architecture.
  2. What are the tools Selenium supports?
    1. What is Selenium RC?
    2. What is Selenium IDE?
    3. What is Selenium Webdriver?
    4. What is Selenium Grid?

Selenium Components and the Test Automation Tools.

If you stare at the below snapshot, you will have a fair understanding of the Selenium components, both internal and the external ones. In this picture, we’ve depicted the entire hierarchy of the Selenium framework.

Selenium Components for Test Automation

Selenium Components for Test Automation.


Let’s now have a brief overview of some of the key Selenium components.

1- Selenium 1.0 (RC).

Selenium RC has been the core Selenium framework for a long time. The emergence of WebDriver project delivered Selenium 2.0 which is new and much stronger tool. Though, it is still one of a very useful Selenium components.

Though, Selenium RC is still active but in maintenance only mode. It has few features that aren’t available or deprecated in Selenium 2.0. It is made up of two subparts.

Selenium RC components are as follows:

The Selenium Server – It starts and terminates the browser, translates, and processes the Selenium commands sent from the test app. It behaves like an HTTP proxy, controls and verifies the HTTP messages exchanged between the client and the application under test.

Client libraries – This module is the interface between the programming language and the Selenium Server. Selenium supports many programming languages, so their client libraries. The most common of them are Java, CSharp, Python, and Ruby.

When should you use Selenium RC?

You decide to choose it in the following scenario.

  • While writing a test case using a more expressive language than Selenium.
  • The need of cross-browser and cross-platform testing.
  • Need to deploy tests in a distributed infra using Selenium Grid.
  • Testing of an application in a new browser having JavaScript support.
  • For testing the web applications that supports AJAX.

2- Selenium IDE.

Selenium IDE is a fully featured development environment (IDE) for composing the Selenium tests. It comes in the form of a Firefox Add-On. You can use it to record, edit, and for the debugging purpose. Initially, its creator used to call it as Selenium Recorder. He was Shinya Kasatani, who developed the tool and submitted to the Selenium community in 2006. It has recently got an upgrade and now it supports the Webdriver and more languages.

The beauty of this tool is that you can record a test script, customize it or write a new test from the scratch all by yourself. It does have autocompletion support for the Selenium commands, so you don’t need to remember their exact syntax. Like every software has limitations, so the IDE has one. It doesn’t have the ability for the iterative and parameterization testing. Though you can fix this limitation by using the Webdriver.

There are few Selenium terms that you need to know for getting a start with the Selenium IDE.

  • Selenese commands such as type, open, clickAndWait, assert, verify, etc.
  • Locators such as ID, Name, XPath, CSS selector, etc.

What can you do with Selenium IDE?

  • Run a customized JavaScript using the runScript command.
  • Export test cases in various supported formats.
  • Compose tests with limited programming skills.
  • Group test cases into test suites which you can convert into Selenium RC or Webdriver format.
  • Test a web application only with Firefox.

3- Selenium WebDriver.

Selenium WebDriver is the superlative form of Selenium RC. It can process multilingual commands (sent via Selenese or the Client API) and forwards them directly to the web browser. Webdriver has a built-in implementation of the Firefox driver. For other browsers, you need to plug-in their browser specific drivers to communicate and run the tests. There is also a browser free solution known as HtmlUnit webdriver. It is the fastest and the lightest driver and famously known as the <headless driver>. Unlike the other drivers, it does not launch any browser for executing the tests.

What can you do with Selenium Webdriver?

There is no second thought that it is one of the most important Selenium components.

  • Choose from a variety of programming languages to write your test cases.
  • Test web applications which provide rich AJAX-based support.
  • Run test cases using the HtmlUnit headless browser.
  • Easily migrate Selenium RC tests using the “WebDriverBackedSelenium” wrapper.

4- Selenium Grid.

Selenium Grid is a dynamic tool that can distribute and run the Selenium tests across many physical/virtual machines in a concurrent order. It can significantly expedite the testing process across different browsers and reduce the testing cycle by giving quick and accurate results.

Selenium Grid can simultaneously invoke the multiple instances of WebDriver (or Selenium RC) tests using the same test code. You just have to make the test code is available on every node running the tests.

Selenium Grid architecture consists of a Hub and a Node.

Hub – You can imagine it as a server component which pipelines and triggers the tests. A Selenium Grid has a single dedicated Hub, which runs when the test starts and shuts down after finishing up executing all the tests.

Node – Nodes are meant to run the Selenium instances which the Hub uses to launch the tests. The grid can have many nodes running on a similar or distinct OS. You need to make sure that each node has access to the Selenium supported browsers.

What can you do with Selenium Grid?

  • Simultaneous execution of Selenium RC/Webdriver tests in different browsers and on a variety of the operating systems.
  • Run a large Selenium test suite and to finish it in the shortest possible timeframe.