Introduction to Selenium Test Automation Tool

What is Selenium?

In simple words, Selenium is a Test Automation Tool developed by the company named "ThoughtWorks" from the year 2004.

Things that Selenium can automate

Selenium can automate Web Applications which generally run in Web Browsers. For example, Selenium can automate web applications like, as it runs over web browser.

Things that Selenium cannot automate

Selenium cannot automate Desktop / Window based applications which don't run on the web browsers. For example, Selenium cannot automate desktop / window based applications like MS Word, MS Excel etc. Luckily most of the applications in the market are Web Applications.

Selenium is an open source and free tool

Unlike other proprietary tools which require us to purchase license for using them, Selenium is an open source and free tool. We don't have to spend a single penny for using Selenium tool. Read more at the below link:

Different components in Selenium

Selenium is not a single tool, instead it is a set of tools. The below are the four different components which we together call as Selenium:

  • Selenium IDE
  • Selenium RC
  • Selenium WebDriver
  • Selenium Grid

Browsers supported by Selenium

Most of the projects automate their applications for Firefox, Chrome and Internet Explorer browser types. The below are the 5 browser types that Seleniums supports in total:

  • Firefox
  • Chrome
  • Internet Explorer
  • Safari
  • Opera

Operating Systems supported by Selenium

Selenium supports all the famous operating systems in the market. The below are the 3 operating systems that Selenium supports:

  • Windows
  • Macintosh
  • Linux

Programming languages supported by Selenium

Selenium supports multiple programming languages for creating automation scripts. Hence we can use any of the below programming languages supported by Selenium:

  • Java
  • C#
  • Ruby
  • Python
  • Perl
  • Haskell
  • Objective-C
  • R
  • JavaScript

Out of all the languages supported, Selenium has more support for Java language and most of the projects use Java, C#, Ruby & Python for automation the scripts using Selenium. And also, we can automate the scripts in Selenium using Java language, even though the application under test is developed using C# language.

Different versions of Selenium

So far, Selenium was released into the market in 3 different versions. The below are the three different versions of Selenium:

  • Selenium 1
  • Selenium 2
  • Selenium 3

The latest version of Selenium is Selenium 3 and it got released into the market on Oct 13, 2016.

History of Selenium

Selenium Core

Selenium was created by Jason Huggins in 2004. To avoid repeated execution of test cases day by day, he created a javascript program and named it as JavaScriptRunner which was later renamed as Selenium core. Over a period of time, Applications were only allowing the internal JavaScript programs by treating the external JavaScript programs as a security breach. This became a drawback for Selenium Core as it uses JavaScript programs to interact with the Applications under test. To overcome this problem while testing using Selenium Core, application testers used to install the Selenium Core's JavaScript programs into the Application code's local copy.

Selenium RC

To overcome the drawback of Selenium core, Paul Hammant has created a proxy server named 'Selenium RC' to trick the application under test that the JavaScript programs are in the same local machine where the application is residing, even though it is not. The drawback of Selenium RC approach is, we have to use a proxy server named 'Selenium RC' to communicate between the Application code and Automation code.

Selenium Grid

Selenium Grid was developed by Partick Lightbody, to reduce the time of Automation scripts execution by running the scripts in parallel on different machines. i.e. Instead of executing all the scripts on a single machine, to reduce the time of execution, all the scripts will be divided across different machines and executed simultaneously.

Selenium IDE

Selenium IDE was developed by Shinya Kasatani, to record the tests like recording a video and execute the recorded tests like playing a video. Hence Selenium IDE is a record and playback tool. Selenium IDE is release into the market as a Firefox add-on/plugin/extension and can be installed on the top of the default Firefox browser. Once installed, we can simply record the tests on firefox browser and playback when required.

Selenium 1

Selenium 1 is nothing but the combination of Selenium IDE, Selenium RC and Selenium Grid.

Selenium WebDriver

Selenium WebDriver was created by Simon Stewart in 2006. As the browsers and web applications were becoming more powerful and not allowing external JavaScript programs. While Selenium RC was tricking the Browser that the Selenium Core's JavaScript program is part of the Application code, by using the proxy server as a communicator. But Selenium WebDriver used the concept of Native Drivers to directly interact with the Application under test and hence eliminated the need for a proxy server. Selenium WebDriver got the support from the largest vendors of the Browsers like Firefox, Chrome, Internet Explorer, Opera and Safari to make Selenium a native part of their browsers. Hence the browsers won't treat Selenium JavaScript programs as an external. The native drivers available for the supported browsers are FirefoxDriver, ChromeDriver, InternetExplorerDriver, SafariDriver and OperaDriver. The development of these drivers is done by the Selenium guys, even though the drivers are native to browsers.

Selenium 2

Later Selenium 1 (i.e. Selenium IDE + Selenium RC + Selenium WebDriver) merged with Selenium WebDriver to make Selenium more powerful and got released into the market as Selenium 2 on July 8th, 2011. Earlier to this merger, there used to be separate teams for developing Selenium RC an Selenium WebDriver. As there two teams identified that Selenium can become more powerful on merging Selenium RC and Selenium WebDriver, they have released the merged version of Selenium as Selenium 2 into the market.

i.e. Selenium 2 is the combination of Selenium 1 and Selenium WebDriver.

Selenium 3

Selenium 3 is the latest version of Selenium and is released into the market on Oct 13, 2016.

Change # 1  -  The big change in this version is that the Selenium RC which is part of Selenium 2 is dropped out in Selenium 3. Selenium RC which was internally implementing Selenium Core's JavaScript program libraries is now replaced with the backed WebDriver API implementation. i.e. What ever the tasks that can be performed only by Selenium RC's JavaScript implementation, can now be performed using the backed WebDriver API implementation which is more flexible. There is no change in the WebDriver implementation from Selenium 2 to Selenium 3. Only the Selenium RC JavaScript libraries got replaced with backed WebDriver API implementation from Selenium 2 to Selenium 3. There is less impact due to this change, as most of the users are writing tests in WebDriver, but there is significant impact on the users who are writing tests in Selenium RC, as Selenium RC wont be supported by Selenium team in future releases and hence should migrate to WebDriver for future support.

Change # 2 -  Another big change in Selenium 3 is that, we have to use Mozilla's gecko driver for running Selenium automation scripts on Firefox browser. Till Selenium 2, development and support of Selenium driver for firefox is provided by Selenium guys using FirefoxDriver class in Selenium, but from Selenium 3 the development and support for Selenium driver for firefox browser will be provided by Mozilla Firefox Browser vendor using the gecko driver. Hence from Selenium 3, we have to use gecko driver in order to execute the Selenium Automation Scripts on Firefox Browser.

Change # 3 - Apple company will be providing the support for Safari Driver for executing the Selenium Automation scripts on Safari browser of macOS Sierra Operating System.

Change # 4 - Microsoft company will be providing the support for Edge Driver for executing the Selenium Automation scripts on Edge Browser.

Hence major change in Selenium 3 from Selenium 2 is the dropping out of Selenium RC JavaScript libraries implementation by replacing them with Selenium WebDriver's API implementation. And also the other major change is that the browser vendors have taken the ownership to support the drivers which are required to run the automation scripts on the browsers. i.e. Development support for gecko driver is provided by Mozilla, safari driver is provided by Apple and edge drive is provided by Microsoft.

No comments: