Introduction to Selenium – The Best Automation Tool

In this article, we will start with an Introduction to Selenium and see the Features and Drawbacks of Selenium. Further, we will look at the Selenium tools. We will learn how to automate a web application using selenium in further articles

What is Selenium

Selenium is an open-source, free, and widely used Web UI automation testing framework. Selenium supports multiple languages like Java, Python, Ruby, C#, PHP, etc. It supports various operating systems like Windows, Mac, Linux, Android, iOS, Solaris, etc. And it also supports testing on multiple browsers like Chrome, Mozilla Firefox, Internet Explorer, Edge, Opera, Safari, etc.

Selenium Features

  • Selenium is an open-source and portable Web UI automation testing framework.
  • Selenium IDE provides a playback and record feature for automation tests that don’t need any type of programming language.
  • Selenium supports different types of systems, programming languages, and web browsers. They are listed below –
    • Systems – Windows, Mac, Linux, Android, iOS, Solaris, etc.
    • Programming Languages – Java, Python, Ruby, C#, PHP, etc.
    • Browsers – Chrome, Mozilla Firefox, Internet Explorer, Edge, Opera, Safari, etc.
  • Selenium supports parallel execution which increases the efficiency of tests.
  • Selenium can be integrated with frameworks like Ant and Maven for code compilation.
  • Selenium can be integrated with testing frameworks like JUnit and TestNG.
  • We don’t need to install a selenium server as selenium WebDriver can directly interact with the browsers.

Drawbacks of Selenium

  • We can’t perform automation testing for desktop applications using selenium.
  • We can’t perform automation testing for web services like REST and SOAP using selenium.
  • We can’t perform automation testing on images. For image testing, we need to integrate the Sikuli tool.
  • Selenium requires a good knowledge of programming skills to automate tests more effectively.
  • Selenium does not support any built-in reporting capability, you need to integrate different plugins like JUnit and TestNG for test reporting.
  • Selenium is not accurate when dealing with dynamic web elements.
  • Selenium is not efficient to handle timeouts, waits, sync, and page load issues.
  • Selenium does not automate captcha, barcodes, and fingerprints.

Selenium Tool Suite

Selenium is not only a single suite but is a suite of software, each of them following a different approach for automation testing. It has four major components which include – 

  1. Selenium Integrated Development Environment (Selenium IDE)
  2. Selenium Remote Control (Selenium RC) – (Now Deprecated)
  3. Selenium WebDriver
  4. Selenium Grid
Selenium Tool Suite
Fig 1 – Selenium Tool Suite

1 – Selenium IDE

Selenium IDE is the easiest tool for web automation testing. It provides record and playback functionality on test scripts. It is implemented as a Firefox extension that creates tests very quickly. It is easy to install and learn this tool. All recorded scripts can be exported in many languages like HTML, Java, Python, Ruby, and, C#. We can use these exported scripts in Selenium.

2 – Selenium RC

Selenium RC is deprecated officially by Selenium. It is an important component of the Selenium Test Suite. It enables a tester to write tests in any programming language to automate the web application against any HTTP website.

It comes with two components – 

  1. Selenium RC Server – Acts as an HTTP server for web requests.
  2. Selenium RC Client – Libraries for the preferred programming language.
Selenium RC
Fig 2 – Selenium RC

3 – Selenium WebDriver

Selenium WebDriver was introduced first with Selenium v2.0. In WebDriver, the test scripts can be written in any programming language and can be run directly on web browsers. Before Selenium WebDriver we need to install a selenium server that interacts with the web browsers. Selenium Web Driver performs much faster than Selenium RC as it directly interacts with the web browser.

Some of the frequently used web drivers include :

  • Mozilla Firefox Driver (Gecko Driver)
  • Google Chrome Driver
  • Safari Driver
  • Internet Explorer Driver
  • HTML Unit Driver (headless driver)

4 – Selenium Grid

Selenium Grid allows us to run test scripts on different machines and different browsers in parallel. We can run our tests simultaneously on different machines with different OS and different browsers. It follows the Hub-Node Architecture to achieve parallel execution.

The two components of Selenium Grid architecture are – 

  • Hub – It is the master node of the network. It is the server that accepts the requests from the WebDriver client and routes the test commands that are in JSON format to multiple nodes. It takes the commands from the client and executes them remotely on the different nodes in parallel.
  • Node – It is a remote device that consists of an OS and a remote WebDriver. It receives the requests from the hub in JSON format and executes them using WebDriver.
Selenium Grid
Fig 3 – Selenium Grid

Conclusion

Selenium is an open-source, free, and widely used Web UI automation testing framework. Selenium allows a tester to run the test scripts on different machines along with different browsers and supports various programming languages. It also provides Selenium IDE which doesn’t require that much programming skills. Selenium has some drawbacks too but we can use some third-party software to handle some of the drawbacks.

Resources

💖 If you like this article please make sure to Like, Comment, and Share it with your friends and colleagues.

Follow us on our social networks –