Breaking News

Functional testing

Functional testing of web applications with selenium

Many tools for automated web testing are protocol drivers. These tools drive the tests through the HTTP protocol. This is in many cases suitable to test the server side of the application. For applications which heavily use Javascript this approach can not be taken. 

In the extreme as we see it with current AJAX applications today the html page is only loaded once by the web client and after that all communication with the server is handled by Javascript completely. On top of that it is often required that those application supports multiple browsers. 

Because today browser implementations still handle Javascript and the DOM differently a protocol driver is relatively useless for testing and a application driver is needed.

Selenium is a test tool which drives the test of a web application in the web browser. Selenium supports various browsers (IE, Firefox, Safari and most other browsers) on various platforms. The open source initiative around Selenium was started in 2004 by Jason Huggins.

Selenium is the type of non functional tools you need in order to test the application in the browser in the way manual testers would. JavaScript and the DOM are covered by your Selenium tests.

Selenium Core

Selenium Core is at heart a set of JavaScript code that executes tests which are contained in a HTMl table. Those tests life within the browser. The browser sees a test page which contains and drives your application. This is a simple concept but it is very effective and portable (to all the platforms mentioned above) at the same time.

Selenium IDE

Writing web application tests by hand without tool support is exhausting and almost impossible at lager scale in most of the testing companies. The tooling support you need is Selenium IDE. Selenium IDE is a Firefox extension for recording tests. It records all user interaction while browsing your application and you just need to add your verification steps while doing so.

The complete list of available selenium commands is available at Selenium Core TestRunner reference page:

A test case has been recorded. To resolve timing issues with execution of the JavaScript I had to insert a waitForElementPresent condition.

Selenium Remote Control (RC)

The Selenium RC provides a proxy server in order to treat the web application in a way that the browser thinks that the Selenium Core JavaScript files have the same origin as the web application. As a consequence the “same origin policy” of the browser is not violated.

Run the server part of Selenium RC with “java -jar selenium-server.jar”. This is often also called Selenium Server.

Now we can easily execute the test case:

It takes additional overhead (~25 sec) to prepare the profile and launch the browser.

Selenium Grid

Selenium Grid is a platform to support parallel execution of test cases. The grid consists of multiple machines each running its own Selenium Server. Through parallel execution the completion time of automated web application testing can be drastically reduced.


Selenium IDE is a Firefox plugin. Open Firefox and select “Tools|add-ons|Get Add-ons”. Search for Selenium IDE and select “Add to Firefox”.

Everything else you usually need is in Selenium RC. Get the latest snapshot from:

At time of writing the latest snapshot resolved some issues with Firefox 3 on Ubuntu and OS X. Unpack the “selenium-python-client-driver” somewhere on your PYTHONPATH. You also need the selenium-server.jar to run the server part of Selenium RC.

Leave a Reply

Your email address will not be published. Required fields are marked *