Selenium

Overview

Selenium is a tool that employs Javascript in order to take control over your browsers and simulate web surfing activities. Therefore, Selenium is able to replicate any action typically undertaken by a user, such as clicking, typing and retrieving data from web pages.

When combining Selenium with other testing frameworks such as JUnit or TestNG, you are getting a very powerful and complete testing framework for web applications.

Selenium is comprised of 3 main components: Selenium IDE, Selenium Remote Control(RC) and Selenium Grid.

  • Selenium IDE is a plugin for the Firefox browser. It records your actions(clicks, characters typed, etc) on Firefox in order to replay them in the same sequence. As a result, by adding some validations, you can easily create tests through "point and click". It is also able to export recorded tests in different programming languages that can be run by Selenium RC.
  • Selenium Remote Control(RC) is a client and server system that offers the same basic functionalities as Selenium IDE in addition to its own unique features. Due to its design, it is much more flexible and versatile than Selenium IDE. Hence, it supports multiple browsers(e.g. Internet Explorer, Firefox, Opera, Safari, etc) and multiple programming languages(e.g. Java, .Net, PHP, Ruby, Python, Perl, JavaScript, etc). However, flexibility comes at a price. You no longer have the "point and click" luxury of the Selenium IDE. You have to manually write all the codes in order to tell Selenium which actions should be taken on your browser.
  • Selenium Grid allows you to run tests on multiple computers and/or multiple browsers concurrently. Therefore, it reduces the time required to run your tests.

Using Selenium IDE is the easiest way to understand Selenium. Most new users will use it as the entry point and subsequently migrate to Selenium RC for more complex testing and to obtain the support of their full blown programming language of choice.

Limitations

  • Selenium was not designed to do performance/load testing.
  • Selenium is using Javascript to control the browser. Therefore, whatever Javascript can't do, Selenium can't do. For example, it can't control the pop-up window that shows up when you are trying to download a file. However, if you are using Firefox, then you can circumvent this by changing the settings in Firefox to allow direct file saving without the download window acting as an intermediary.

Usage

Here are typical cases where Selenium is used:

  • Functional Testing
  • Browser Compatibility Testing