Selenium: Basic Concepts

Selenium is one of the most popular tools for automating web applications.
What Selenium can do?

There are a lot of capabilities that Selenium provides let’s take a quick sneak on those capabilities:

  • Open Source – Unlike tools like QTP, Selenium is open source, which means that no cost is required to set up and use Selenium. Selenium is free to download and use.
  • Mimic User Actions – Almost all real-world user actions like button click, drag, and drop selection, checkboxes, keypresses, taps, scrolling can automate using Selenium.
  • Easy Implementation – Selenium is famous for being user friendly. 
  • Language Support – The most significant benefit of Selenium is the extensive support for various languages. Selenium supports  programming languages like Java, Python, JavaScript, C#, Ruby, Perl among others.
  • Browser Support – Selenium can work on all the browser vendors that are out there. Selenium has support for Chrome, Firefox, Edge, Internet Explorer, Safari.
  • OS Support – Selenium bindings are available for all the primary OS like Linux, macOS, Windows.
  • Framework Support – Selenium supports multiple frameworks like Maven, TestNG, PYTest, NUnit, Mocha, Jasmine, etc. Selenium integrates well with CI tools like Jenkins, Circle CI, GOCD, Travis CI, Gitlab, etc.
  • Code Reusability – Scripts written for Selenium are cross-browser compatible. Same code can be run for multiple browsers using respective browser binaries and on separate machines in a Grid configuration,
  • Community Support – Since there are a lot of QA’s working on this tool, it is effortless to find resources, tutorials as well as support on communities like Github, StackOverflow, etc.
What are the various components of Selenium?

Selenium is not just an automation tool. It is a suite of tools, and each tool in the suite have specific unique capabilities that help in designing and development of automation framework. All these components can be either used individually or can be paired with one another to achieve a level of test automation.

The below figure shows various components of the Selenium Suite:

Selenium IDE is an extension available for both Firefox and Chrome, which has the record and replay functionality available. 

Selenium RC is a server that acts as a middle man between the user and the browser that needs to interact. RC uses Javascript to work with browsers while allowing the users to write code in the language of their choice. It is deprecated in favor of WebDriver.

Selenium WebDriver is the most commonly used component of Selenium. WebDriver allows users to write custom code in their language of choice and interact with the browser of their choice, through browser-specific drivers. WebDriver works on the OS level and uses a Protocol called JSONWireProtocol to communicate with browsers.

Selenium GRID allows users to run tests on different machines, with different browsers and OS simultaneously, which gives the ability to run tests in parallel, as such saving a lot of time and resources of testing on several machines.

What Selenium can’t do?
  • No support to automate native desktop-based applications- Selenium can be used to automate web-based applications that run on web browsers. However, it cannot automate desktop-based applications.
  • No support for assertions and validity – Selenium provides control to the browser; however, providing assertions and checking mechanisms is not provided by Selenium. Selenium needs to pair with a testing framework like JUnit, TestNG, PyTest, etc. for assertions.
  • No support for image and code scanning – Automation of code scanning scenarios such as Bar code reading, CAPTCHA is not possible using Selenium.
  • No support for API Testing – Selenium mimics the user actions on the browser. So as such, Selenium doesn’t give the capability of testing API.
  • No support for Performance Testing – Selenium cannot perform performance checks or performance testing of the web applications.
  • No inbuilt Reporting – Reporting capability is also not provided by Selenium. That is to say; reporting can be done only by pairing it with a framework like JUnit, TestNG.