5 Minute Guide To Selenium IDE and Selenium Remote Control (Java) Test Tools

By Angsuman Chakraborty, Gaea News Network
Tuesday, July 1, 2008

Selenium is a high quality open source test automation tool for web application testing. Selenium runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac, with plans to support Safari on iPhone soon. Selenium test scripts are portable, can be run from browsers (using Selenium IDE) or from JUNit or NGUnit (using Selenium RC) etc.. For example, test scripts written using Selenium IDE in Firefox on Windows can run on Firefox in Mac or Linux, without changing any code. Selenium tests run directly in browsers and so matches the end-user experience closely.

There are three variants of Selenium, which can be used in isolation or in combination to create complete automation test suite for your web applications.

  • Selenium Core - In Selenium Core the tests scripts (written in HTML) and the Selenium Test Runner (written in Javascript) are uploaded to the same web server that hosts the application you are trying to test. It is a simpler form of Selenium, and suitable for non-developers, but it has some inherent limitations.
  • Selenium IDE - Selenium IDE is a Firefox plugin, which includes the entire Selenium Core, allows you to record, play back, edit, and debug tests in browser. It provides the simplest introduction to Selenium and is highly recommended for beginners. You can save the tests / test suite created in xml or html format. However to run them in an automated fashion you need Selenium Remote Control which is described next.
  • Selenium Remote Control - The Selenium Remote Control allows you to develop test cases and test suites in Java (supports JUnit & NGUnit), PHP, Ruby, Python, Perl and even .NET. It is the most flexible setup but requires some development knowledge to set up and use.
  • Selenium Grid - Selenium Grid allows several Selenium Remote Control servers to be accessed in parallel by Selenium Grid server. This is extremely useful for automated load and stress testing of web applications.

Today we will discuss on how you can easily create automatic test scripts using Selenium IDE and convert them to JUnit tests (which uses Selenium Remote Control) which can be added to your JUnit based automatic regression test suite.

How to create a test plan in Selenium IDE

Creating a test plan in Selenium IDE is very easy, so we will use it to create few simple tests to begin with.

  • Install Selenium IDE 0.8.7, a Firefox plugin.
  • After installing Selenium please restart your Firefox browser for the plugin to be activated.
  • Now you should see a new added menu item named Selenium IDE under your Firefox Tools menu.
  • Open / browse the site for which you want to prepare a test case.
  • Start Selenium IDE from Firefox Tools->Selenium IDE.
  • Browse some pages.
  • Now click red button to stop recording.

At this point you will see Selenium automatically recording your actions. Carefully note the commands, target and value. You can create and insert your own commands/ modify or even delete them. We will show some examples below. In the next section we will see how we can modify the generated tests to suit our needs.

How to create / modify / delete Selenium commands

The default commands generated by Selenium when you are browsing the page as a normal user should be modified to make the test more robust and to add test cases to it.

  • Let’s replace all click commands by clickAndWait. click simply clicks the specified link and goes on to execute the next command without waiting. On the other hand clickAndWait waits for the new page to loaded before executing the next command. clickAndWait should be used to make more robust test cases.
  • Insert assertTextNotPresent command after each clickAndWait command to confirm a text must not be present in the browsed page.
  • Use assertTextPresent command to confirm a text must be present in the browsed page.
  • Finally to test your test plan please click green arrow button to play from the begining or to play from start point.
  • Export the test plan as java file by Selenium IDE File->Export Test As->Java - Selenium RC (for example the file name is SeleniumSTSanityTest.java)
  • Then close your Firefox Selenium ID.

How to run above test plan (automatically generated java file from Selenium IDE) in command line?

  • Download Selenium RC.
  • Unzip it under the same directory where SeleniumSTSanityTest.java (exported test plan as java file from Selenium ID) was saved.
  • Install junit.
  • Go to directory where you unzip selenium-remote-control-1.0-beta-1-dist.zip file.
  • Open a terminal and do the steps below-
    • cd selenium-remote-control-1.0-beta-1/selenium-server-1.0-beta-1
    • java -jar selenium-server.jar (to run the server in interactive mode execute java -jar selenium-server.jar -interactive)
    • If you get an error like Error: com.thoughtworks.selenium.SeleniumException: ERROR Server Exception: sessionId should not be null; has this session been started yet? then ensure that the browser is in the PATH before running the server. For example, you want to run the test in Firefox. Then you should do next two steps.
    • locate firefox-bin (for example it returns /usr/lib/firefox-
    • export PATH=$PATH:/usr/lib/firefox-;
      Note: There is an alternative way to fix above error (browser is not in path). Simply replace chrome with browser PATH in SeleniumSTSanityTest.java file. For example:
      setUp(”https://blog.taragana.com”, “*chrome”);
      setUp(”https://blog.taragana.com”, “*firefox /usr/lib/firefox-”);
      in SeleniumSTSanityTest.java.
      To run the test in opera browser replace chrome with opera.

    Now the selenium server is running and you have to run the Java client located in selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1.

  • Open another terminal.
    • export CLASSPATH=.:selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1/selenium-java-client-driver.jar:/usr/share/java/junit.jar
    • javac SeleniumSTSanityTest.java
    • java SeleniumSTSanityTest

The automatically generated java file SeleniumSTSanityTest.java is likely to have some defects. Fix it by comparing with the example below:

import com.thoughtworks.selenium.*;
import junit.framework.*;
import java.util.regex.Pattern;

public class SeleniumSTSanityTest extends SeleneseTestCase {
    public void setUp() throws Exception {
        setUp("https://blog.taragana.com", "*chrome"); // to run the test in opera replace chrome with opera
    public void testSimpleThoughts() throws Exception {
        assertFalse(selenium.isTextPresent("WordPress database error: ["));
        assertFalse(selenium.isTextPresent("WordPress database error: ["));
        selenium.click("//img[@alt='Übersetzen Sie zum Deutsch/German']");
        assertFalse(selenium.isTextPresent("WordPress database error: ["));
        selenium.click("//img[@alt='Přeložit do Čech/Czech']");
        assertFalse(selenium.isTextPresent("WordPress database error: ["));

    public static Test suite() {
        return new TestSuite(SeleniumSTSanityTest.class);

    public static void main(String args[]) {

Let me know if you have any comments / suggestions on how we can improve this tutorial.


Mukesh Sharma
July 23, 2010: 6:39 am

how to run test cases using selenium using .net framework?

June 2, 2010: 5:31 am

Good tutorial, but one could not get the basic environment required to setup the Selenium RC.
For example, I am interested in using Selenium RC for exporting the PHP tests, So do i need a Local Webserver like XAMPP etc for doing this?

Would appreciate the reply and the updated tutorial on this comment?

April 15, 2010: 5:52 am


As i am new to this selenium, Please could you help me in letting the process of installing selenium IDE for internet explorer. I have done using firefox as my project needs it to be browser compatible we need to test in IE.

February 8, 2010: 7:30 am


I am new to Selenium server. I recorded a few Test cases and saved as Ruby script. But when i try and open them, it says error loading the test case. Please let me know how can I save and run the Test case in Ruby script

January 30, 2010: 4:21 am

I want to run the test in safari browser. so can u give me the steps to set the browser path.. in which file i suppose to change the browser path.. can u give me the exact path?

January 12, 2010: 1:57 am

hitesh is read your web site

November 13, 2009: 1:44 am

thank you !

good tutorial

Selenium IDE good job

invin gagan
November 11, 2009: 7:30 am

I am new to selenium… can selenium IDE generate test execution report?
Please help mu :)..

November 4, 2009: 6:08 am


i am getting timed out error while running the selinium script.

any one help me in this regard.
thanks in advance

Nick C
October 20, 2009: 1:02 pm

In case it’s of any help to anyone, I wrote a quick set of instructions on how to run Selenium RC as a Windows service:


October 15, 2009: 4:39 am


I have an Issue while recording a Test Script in Selenium IDE
I have a form that consists of a mandatory editable type ahead drop-down for Gender.
While recording I don’t use auto complete to fill in the value instead I completely Type Male or Female Value.
The Step itself passes but on the next step which is clicking the Submit Form Button with Target “ext-gen32″, the typed value in the Drop-Down disappears
And thus the record is not inserted.
Is there any other way around for doing that

September 22, 2009: 4:20 pm

Hi, I have to make some testing with a proxy, could you tell me hox I can change the proxy and the port?

Thank you

August 24, 2009: 1:47 pm


I am a new user of selenium,

i wrote fews test suites in selenium IDE and they worked fine.

I face problem with ‘while’ loop and ‘label’ statements, and i have added the goto_extension.js and

problem got rectified.

Now i am facing the same problem when i am trying to run the html file which i recorded in selenium IDE in selenium RC

its saying “unknown command while” . Please somebody help me, resolving it.

I want it to work in selenium RC also.

Saket Mishra
June 3, 2009: 12:09 pm

Hi All,

I am not able to run the Selenium RC server.
Here is my step:

i) To start the server i typed java -jar selenium-server.jar -interactive

the server is getting started.

ii) then i am typing cmd=getNewBrowserSession&1=*firefox&2=https://www.google.com

after typing this two browsers are generated. the first one containing some session id and the second one which should have hit my target URL i.e. google.com is not doing the same but instead it is hitting a target something like this https://localhost:6050/selenium-server/core/Blank.html?start=true

here 6050 is my port number.
please help me with this…
please note that we are using our company’s proxy.

May 14, 2009: 7:47 am

To get of the Selenium Session Id Null issue, there are three things you can try out:

1) Put the firefox bin path in your path, and make sure it does not have any spaces in between.
2) Try deleting your firefox profile.
3) Make sure you mention the protocol. Eg: instead of https://www.google.com, say https://www.google.com

Jerry LeBlanc
April 20, 2009: 12:59 am

Had a few false starts, some things were not obvious to me when I read the tutorial. The following changes got me up and running.
1. Disabled “package com.example.tests;”
2. Add suite and main methodsto generated java code.
3. Deleted server jar from CLASSPATH of client terminal session. This was mentioned explicitly in an older tutorial. Apparently there are some naming conflicts among server and client jar files.
Still in all, very helpful, thank you!!

February 23, 2009: 12:26 pm

The following command does the trick to generate report…

java -jar selenium-server.jar -htmlSuite *

February 4, 2009: 4:48 pm

I want to know the command to convert test case recorded using selenium ide in html to java.. pls let me know the command to do this.

Also, as asked by prabodh.. how do we get results in a result page or is there a way to get output generated in a kind of a html report or something

January 21, 2009: 8:37 am

If I have multiple java classes(selenium tests),then how can I run them together. One more thing is how to get the results in a result page.Please let me know with some examples.

January 9, 2009: 6:36 am

Please NEVER EVER try to automatically translate anything into german

as the result can never be read by a native german speaker! There is no program on this planet that can translate english to german. Sorry, but true.

January 2, 2009: 4:23 pm

For simply web testing there is also the option to use the new iMacros Firefox addon

November 24, 2008: 8:02 am

getting the error “sessionId should not be null; has this session been started yet?”. Is this common with firefox?

November 9, 2008: 5:11 am

export is a linux shell command to export a shell variable. Please refer to bash manual for details.

October 16, 2008: 3:34 pm

getting the error “sessionId should not be null; has this session been started yet?”. I do not have the public void setUp() throws Exception {
setUp(”https://blog.taragana.com”, “*chrome”); // to run the test in opera replace chrome with opera
in my script. where should I locate the firefox-bin. Could you please provide more details


October 15, 2008: 8:35 am


I’m a complete beginner, Im stuck where I run the selenium server and then I have to Export classpath in a new terminal? what does that mean.. how? Do i type that command in cmd? can you please be more specific

thanks :)

October 13, 2008: 3:02 am

Useful link.

falco q sabe leer
September 15, 2008: 2:09 pm

flaco, sos un croto de mierda, no podes pegar post en el traducto y mandarlo de una, no da robar asi, pone un link a la fuente, de ultima si vas a robar por lo menos fijate si te lo tradujo bien.

August 30, 2008: 9:27 am

[...] Guide for Selenium IDE [...]

Zahid Shaikh
July 25, 2008: 8:06 am

Good Tutorial.. But unfortunately - I could not get rid of the “session” error - using code .. I had to add it in PATH.

Also Selenium RC does NOT WORK - if the “test web server” is coded - using Javascript - so that its not “frameable”.(or maybe it was when we redirected to other websites)

will not be displayed