Selenium Introduction

 Introduction

Selenium is one of the most widely used open source Web UI (User Interface) automation testing suite. It was originally developed by Jason Huggins in 2004 as an internal tool at Thought Works.

Selenium supports automation across different browsers, platforms and programming languages.Selenium can be easily deployed on platforms such as Windows, Linux, Solaris and Macintosh. Moreover, it supports OS (Operating System) for mobile applications like iOS, windows mobile and android.

Selenium supports a variety of programming languages through the use of drivers specific to each language. Languages supported by Selenium include C#, Java, Perl, PHP, Python and Ruby.

Currently, Selenium Web driver is most popular with Java and C#. Selenium test scripts can be coded in any of the supported programming languages and can be run directly in most modern web browsers. Browsers supported by Selenium include Internet Explorer, Mozilla Firefox, Google Chrome and Safari.

Selenium can be used to automate functional tests and can be integrated with automation test tools such as MavenJenkins&Docker to achieve continuous testing.  It can also be integrated with tools such as TestNG, & JUnit for managing test cases and generating reports.

Selenium History:

Selenium was initially developed by Jason Huggins in 2004 while he was working as an Engineer in Thoughts Work on a web application that requires frequent testing.

He created the program using JavaScript, after using it he realized the shortcomings of manual testing and the need to curb monotony. He originally named the program JavaScript Test Runner but after realizing the potential of the program, he made it an open source program which he re-named as Selenium Core.

However there were problems. Due to “Same Origin Policy” which prohibits JavaScript from being used from a different Domain name from which it was launched, testers had to go through the stress of installing Selenium Core and Web servers containing web applications to be tested so they can belong to the same domain. Paul Hammant another ThoughtWork’ Engineer offered a solution to this problem by creating Selenium Remote control (Selenium RC) or Selenium 1.

Selenium Grid was developed by Patrick Light body for parallel testing purposes which address the need of reducing time spent on test execution to minimal. Selenium automation test was faster as multiple tests can be carried out simultaneously. Shinya Kasatani of Japan contributed by carrying out a project on Selenium IDE in the year 2006. Selenium IDE helps automate the browser through record and playback feature. Simon Stewart created Web Driver Circa in 2006. This tool helps the software testers to perform tests via programmatic approaches using any programming language that is supported.


 

Selenium Features

o    Selenium is an open source and portable Web testing Framework.

o    Selenium IDE provides a playback and record feature for authoring tests without the need to learn a test scripting language.

o    It can be considered as the leading cloud-based testing platform which helps testers to record their actions and export them as a reusable script with a simple-to-understand and easy-to-use interface.

o    Selenium supports various operating systems, browsers and programming languages. Following is the list:

o    Programming Languages: C#, Java, Python, PHP, Ruby, Perl, and JavaScript

o    Operating Systems: Android, iOS, Windows, Linux, Mac, Solaris.

o    Browsers: Google Chrome, Mozilla Firefox, Internet Explorer, Edge, Opera, Safari, etc.

o    It also supports parallel test execution which reduces time and increases the efficiency of tests.

o    Selenium can be integrated with frameworks like Ant and Maven for source code compilation.

o    Selenium can also be integrated with testing frameworks like TestNG for application testing and generating reports.

o    Selenium requires fewer resources as compared to other automation test tools.

o    WebDriver API has been indulged in selenium whichis one of the most important modifications done to selenium.

o    Selenium web driver does not require server installation, test scripts interact directly with the browser.

o    Selenium commands are categorized in terms of different classes which make it easier to understand and implement.

o    Selenium Remote Control (RC) in conjunction with WebDriver API is known as Selenium 2.0. This version was built to support the vibrant web pages and Ajax.

Selenium Limitations:

o    Selenium does not support automation testing for desktop applications.

o    Selenium requires high skill sets in order to automate tests more effectively.

o    Since Selenium is open source software, you have to rely on community forums to get your technical issues resolved.

o    We can't perform automation tests on web services like SOAP or REST using Selenium.

o    We should know at least one of the supported programming languages to create tests scripts in Selenium Web Driver.

o    It does not have built-in Object Repository like UTF/QTP to maintain objects/elements in centralized location. However, we can overcome this limitation using Page Object Model.

o    Selenium does not have any inbuilt reporting capability; you have to rely on plug-ins like JUnit and TestNG for test reports.

o    It is not possible to perform testing on images. We need to integrate Selenium with Sikuli for image based testing.

o    Creating test environment in Selenium takes more time as compared to vendor tools like UFT, RFT, Silk test, etc.

o    No one is responsible for new features usage; they may or may not work properly.

o    Selenium does not provide any test tool integration for Test Management.

Selenium vs QTP

Selenium and QTP are the most frequent used automation test tools in the market. Hence, we have compared some of the features of Selenium over QTP.

Features

Selenium

HP QTP

License

Open source tool

Required

Customer support

Dedicated HP support

Selenium community forums

Test Support

Supportsautomation only for web-based applications.

Support tests on both web and desktop based applications.

Resource consumption during test scripts execution

Low resource consumption

High resource consumption

Supported programming languages

Java, C#, Ruby, Python, Perl, PHP and JavaScript

VB Script.

Supported Environments

Android, iOS, Windows, Linux, Mac, Solaris.

Only for Windows

Supported Browsers

Google Chrome, Mozilla Firefox, Internet Explorer, Edge, Opera, Safari, etc.

Specific versions of Google Chrome, Mozilla Firefox and Internet Explorer.

Object Repository/Recovery Scenario

Absent

Built-in object repository and recovery scenario.

Browser Controls

None

Controls like favourites bar, backward and forward buttons can be accessed within the browser.

Test Report Generation

It relies on external tool for generating test reports.

Built-in test report generation within the tool.

Parameterization

You have to rely on any one of the supported programming language for parameterization.

Built-in tools are available for parameterization.

Selenium Tool Suite

Selenium is not just a single tool but a suite of software, each with a different approach to support automation testing. It comprises of four major components which include:

  1. Selenium Integrated Development Environment (IDE)
  2. Selenium Remote Control (Now Deprecated)
  3. WebDriver
  4. Selenium Grid


1.Selenium Integrated Development Environment (IDE)

Selenium IDE is implemented as Firefox extension which provides record and playback functionality on test scripts. It allows testers to export recorded scripts in many languages like HTML, Java, Ruby, RSpec, Python, C#, JUnit and TestNG. You can use these exported script in Selenium RC or Webdriver.

>Selenium IDE has limited scope and the generated test scripts are not very robust and portable.

2. Selenium Remote Control

Selenium RC (officially deprecated by selenium)allows testers to write automated web application UI test in any of the supported programming languages. It also involves an HTTP proxy server which enables the browser to believe that the web application being tested comes from the domain provided by proxy server.

Selenium RC comes with two components.

  1. Selenium RC Server (acts as a HTTP proxy for web requests).
  2. Selenium RC Client (library containing your programming language code).

 

The figure given below shows the architectural representation of Selenium RC.




Selenium RC had been considered quite effective for testing complex AJAX-based web user interfaces under a Continuous Integration System.

3. Selenium WebDriver

Selenium WebDriver (Selenium 2) is the successor to Selenium RC and is by far the most important component of Selenium Suite. SeleniumWebDriverprovides a programming interface to create and execute test cases. Test scripts are written in order to identify web elements on web pages and then desired actions are performed on those elements.

Selenium WebDriver performs much faster as compared to Selenium RC because it makes direct calls to the web browsers. RC on the other hand needs an RC server to interact with the web browser.

Since, WebDriver directly calls the methods of different browsers hence we have separate driver for each browser. Some of the most widely used web drivers include:

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

4. Selenium Grid

Selenium Grid is also an important component of Selenium Suite which allows us to run our tests on different machines against different browsers in parallel. In simple words, we can run our tests simultaneously on different machines running different browsers and operating systems.

Selenium Grid follows the Hub-Node Architecture to achieve parallel execution of test scripts. The Hub is considered as master of the network and the other will be the nodes. Hub controls the execution of test scripts on various nodes of the network.

Comments