Selenium: web application testing

  • Multi-browser (IE, Firefox, Safari)
  • Multi-platform (Windows, Linux, and Macintosh).

Selenium IDE

Selenium IDE is a Firefox extension. Watch the video tutorial and download it

Note: the recorded test can be saved as HTML, Java, Python, Ruby, Perl and C#.

Selenium RC (Remote Control)

Selenium RC comes in two parts:

  • server which launches, controls, and kills browsers.
  • client libraries (Java, Python, PHP, Ruby, Perl and .NET) to control the server.

Installation on Ubuntu

  • check java references Sun 1.5 version. Otherwise:
cd /etc/alternatives
sudo rm java
sudo ln -s  /usr/lib/jvm/java-1.5.0-sun- java
  • add /usr/lib/firefox/firefox-bin to your PATH


  • launch Selenium server:
java -jar selenium-server.jar -interactive

Selenium jUnit tests in Eclipse

  • it's possible to set some breakpoints and launch the test in debug mode (Run -> Debug Last Launched)
  • advanced example:
package jj;
import java.util.Random;
import junit.framework.TestCase;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class EncountersRegistrationTest extends TestCase {
	// TODO *** update this variable to match your config ***
    private static final String LOCAL_LOGIN_URL = "";
	private Selenium selenium;
    public void setUp() {
        selenium = new DefaultSelenium("localhost", 4444, "*firefox", LOCAL_LOGIN_URL);
    public void testParticipantRegistration() {"/encounters23/login.html");
		assertEquals("Login", selenium.getTitle());
		selenium.type("code", "BC011234");"lang");"//input[@value='Submit']");
		assertEquals("Registration 1 - Basic Information", selenium.getTitle());
		Random random = new Random();		
		selenium.type("username", "test_" + random.nextInt(10000));
		selenium.type("email", "");"province", "label=Nova Scotia");"//input[@value='Save And Continue']");
		// preferences"theme_5092", "label=11");"document.forms[0].terms[4]"); // checkbox"//input[@value='Save And Continue']");
		// school
		assertEquals("Registration 5 - School", selenium.getTitle());"school", "index=3");"//input[@value='Save And Continue']");
    public void tearDown() {


cool site
Feb 23, 2011
thank you for writing this page
May 21, 2012
great info! thanks!
May 12, 2013