At present, Selenium is the most popular and widely used tool in the market. This open-source web automation tool is primarily used for web applications. The testing framework of Selenium performs across various browsers and platforms like Linux, Mac, Windows, Firefox, Chrome, IE, as well as Headless Browsers. With a browser add-on Selenium IDE, the tool can record and playback, which means a tester can use these features even with learning Selenium IDE. The powerful Selenium WebDriver helps to create more complex and advanced automation scripts. Also, testers can write in various programming languages like Java, Perl, JavaScript, PHP, Python, C#, Ruby, and Groovy.

Why Selenium is Most Widely Used Test Automation Tool?

Selenium Framework, which has been used by over 41 thousand companies across the world, enjoys the highest market share among the other contemporary software testing tools. A study from Enlyft (formerly iDatalabs), suggests that Selenium has a market share of 28.36%.

While there are many benefits Selenium offers, here are some of the major benefits that Selenium brings:

  • Transparency: Ensures agility and transparency across the cross-functional teams of SDLC process (developers, quality assurance, operations, clients and the management).
  • Platform Independent: Avoids the software tester’s time in writing test scripts for each platform to be tested. As it follows the principle of writing one test script and runs on any platform.
  • Quickens TTM and TTD: In the case of manual testing, the testing is very painful and uncertain process because of which the product delivery and time to market schedules are missed. This increases the cost of overall project. However, Selenium avoids testers to write test script for each platform.
  • Fosters Continuous Integration Efforts: Continuous Integration and continuous delivery are the modern agile-enablers of the software development process.
  • Visibility in End-to-End Testing: In case of end-to-end applications testing selenium offers great visibility.
  • Reduces Turnaround Time: Selenium framework facilitates the testing teams to automatically run the multiple test cases parallelly on multi-browser platforms. This reduces the turnaround time by ensuring extreme testing quality.
  • Integration With Other Tools: Selenium with Java is famous as rest of the available jars like ExtentReports, Sikuli, Appium, and so on. Selenium tool provides flexibility for testers to get integrated with these jars to extend its functionalities to new frontiers:
  1. Selenium integration with “ExtentReports” can generate graphs and reports, which can be used to provide deeper insights on testing status to the clients.

2. Integrating Selenium with “Sikuli”can test web applications involving videos and Images.

3. Testing of web apps on Android or iOS platforms can achieved by integrating Selenium with Appium.

Components of Selenium

Selenium IDE

Selenium IDE (Integrated Development Environment) is mainly a Firefox plugin. It is one of the simplest frameworks in the Selenium Suite. It allows us to record and playback the scripts. If you wish to create scripts using Selenium IDE, you need to use Selenium RC or Selenium WebDriver to write more advanced and robust test cases.

In Selenium IDE, the test case execution is very slow, and the report generation step for the test cases is not good as compared with other components. It doesn’t support test case execution in parallel or remote execution.

Few drawbacks of Selenium IDE are:

  1. It restricts the test case execution to the Firefox browser.
  2. It doesn’t extend the support to mobile-based testing like iPhone/Android testing.
  3. The execution of test cases is very slow and the report generation step is not good when compared with other components.

Selenium RC (Remote Control)

Selenium RC, also known as Selenium 1, was the main Selenium project for a long time before the WebDriver merge brought up Selenium 2. It mainly relies on JavaScript for automation. It supports Ruby, PHP, Python, Perl and C#, Java, Javascript. It supports almost every browser out there.

Some other features of Selenium RC:

  • It is based on JavaScript. It doesn’t support a Record/Playback feature.
  • It is based on a client/server architecture, which implies -> whenever you want to execute the test cases/test scripts, you need to start the server manually.
  • It supports parallel execution of test cases as well as remote execution with the help of Selenium Grid.

Selenium Grid

Selenium Grid is a tool which is used together with Selenium RC. It is used to run tests on different machines against different browsers in parallel. This implies running multiple tests at the same time against different machines running different browsers and operating systems.

Selenium Web Driver

Selenium Webdriver is an open-source collection of APIs which is used for testing web applications. The Selenium Webdriver tool is used for automating web application testing to verify that it works as expected or not. It mainly supports browsers like Firefox, Chrome, Safari and Internet Explorer. It also permits you to execute cross-browser testing.

Basic Commands

Below are few basic commands in selenium.

  • Get method: This method is a part of the driver class and can be accessed by using driver.get() method. It can be used to navigate to a web page by passing a URL as a parameter.
  • Navigate method: This method like ‘get’ is a part of same class and the driver.navigate().to() method opens a web page like driver.get() method.
  • Writing in a textbox: The sendKeys() method help in writing in a textbox. It can also act for entering any element of text input type.

Take a screenshot in Selenium

In order to capture a screenshot in Selenium, one has to utilize the method TakesScreenshot. This notifies WebDrive that it should take a screenshot in Selenium and store it.


File file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
String screenshotBase64 = ((TakesScreenshot)driver).getScreenshotAs(OutputType.BASE64);

Selenium Waits

Selenium supports two types of waits and they are as follows

  1. Implicit Wait
  2. Explicit Wait

The Implicit wait will tell the web driver to wait for a certain amount of time before it throws a “No Such Element Exception”. The default setting of Implicit wait is zero. Once you set the time, the web driver will wait for that particular amount of time before throwing an exception.

Syntax: driver.manage().timeouts().implicitlyWait(TimeOut, TimeUnit.SECONDS);

It is a concept of the dynamic wait which waits dynamically for specific conditions. It can be implemented by WebDriverWait class. To understand the Explicit wait in Selenium Webdriver, you should know the requirement why we use wait statement in programs.

Selenium 4 new Features

Continuous Integration

“Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily — leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible” — Martin Fowler

Software Engineering undergraduate at University of Kelaniya