The Selenium RC (Selenium Remote Control) was the leading selenium tool used for long time before Selenium Webdriver (Selenium 2.0). Now a days, selenium RC is rarely in use. However, some users still develop the scripts using Selenium RC.

Selenium RC is an critical component in the Selenium test suite and used to design UI tests. It allows to write automated web application UI tests with the help of programming languages such as Java, C#, Perl, Python and PHP. The tests are created for the automating web applications in the programming languages through JavaScript enabled browsers.

It enables a tester or a developer to write test cases in any programming language to automate UI tests for web applications.

It is used to create more difficult tests such as querying a database, reading and writing files, and emailing test results.

How does the Selenium RC work?

The Selenium RC working is dependent on its components and each of the component has a its own role to perform in running the test scripts.

What are the RC components?

The Selenium RC components are responsible for the test scripts automation. They are -

  • Selenium Server
  • Client Libraries

Selenium RC Architecture

Selenium RC works like the client libraries communicates with the Selenium RC Server by passing every Selenium command for execution. After that the server sends the Selenium command to web browser using Selenium-Core JavaScript commands.

The web browser runs the Selenium command using its JavaScript interpreter.

selenium remote control

The Selenium RC architecture is a client/server module. The clients and server communicate through appropriate internet protocols -

  • The Selenium Server is responsible for launching and terminating the browsers.It interprets and runs the Selenium commands sent from the test program. They act as the HTTP proxy, intercept and verify HTTP messages passed from the AUT to the browser.
  • There are client libraries offer an interface between the Selenium server and each of the programming languages.

Selenium RC's architecture was complicated for the following reasons -

  • Needs to install and launch Selenium Remote Control Server separately before running test scripts.
  • The RC server acts as a Selenium RC execution process intermediate between the browser and Selenium commands.

Selenium RC execution process

Below operations are performed in background when a test script is executed in Selenium RC -

  • The RC server injects a Javascript program (Selenium Core) into the browser.
  • Once the Selenium Core program is injected, it starts receiving instructions from the RC server based on test scripts.
  • Selenium Core executes all these instructions as JavaScript commands.
  • The web browser executes all the commands given by Selenium Core and returns the test summary back to the server.


  • Cross-browser and cross-platform.
  • Condition operation and looping can be performed.
  • Supports data driven testing.
  • Has easy, small, developed and complete API.
  • Supports new browsers.
  • Faster execution with IDE.


  • Complicated Architecture and installation is more difficult.
  • Selenium RC Test scripts execution is time-consuming as it uses JavaScript commands as instructions to the browser. This process results slow in performance.
  • Tester must have programming knowledge.
  • Slower execution than WebDriver.
  • API’s are less object-oriented and contains redundant and confusing commands.
  • Selenium RC server needs to be running.
  • No support for Headless HTMLUnit browsers (Invisible browser).

RC Scripting

Now let us write a sample script using for understanding Selenium RC. We will perform a Percent calculation using ‘Percent Calculator’ that is present under the ‘Math Calculators’ module.

Running Selenium Server

Before starting any tests, server must be started. Go to the directory where Selenium RC’s server is located and run the following from a command-line console.

java -jar selenium-server-standalone-<version-numer>.jar

In this example, we have used version 3.141.59, so start server like below –

selenium remote control

Running RC Client

Create the new Selenium Project through "File > New > Java Project".

selenium remote control

New popup gets opened. Name the project as "tcproject".

selenium remote control

Verify the below details and click on "Finish" button to proceed further.

  1. "Use default location" option should be checked.
  2. "Use an execution environment JRE:" should be checked.
  3. "Create separate folders for sources and class files" should be checked.
selenium remote control

"Right click" on newly created "Selenium project" and select "New > Package"

selenium remote control

Popup gets opened. Enter the name of the Package as "tcpackage" and click on "Finish" button.

selenium remote control

"Right click" on newly created package "tcpackage" and select "New > Class".

selenium remote control

Popup gets opened. Enter the name of class as "MyClass" and click on "Finish" button to proceed.

selenium remote control

Now selenium WebDriver's into Java Build Path and the eclipse now looks like below.

selenium remote control

Now add below code to the class.

In the below example, we are calculation 20th percent of 200.

package tcproject;  

import com.thoughtworks.selenium.DefaultSelenium; 
import com.thoughtworks.selenium.Selenium;  

public class rcdemo { 

    public static void main(String[] args) throws InterruptedException{  
        // Instatiate the RC 
        Server Selenium selenium = new DefaultSelenium("localhost", 
                4444 , "firefox", ""); 
        // Start"/"); 		
        // Open the URL selenium.windowMaximize();  
        // Click on Link Math Calculator"xpath=.//*[@id='menu']/div[3]/a"); 
        // Wait for page load 
        // Click on Link Percent Calculator"xpath=.//*[@id='menu']/div[4]/div[3]/a"); 
        // Wait for page load  
        // Focus on text Box selenium.focus("name=cpar1"); 
        // enter a value in Text box 1 
        selenium.type("css=input[name=\"cpar1\"]", "20");  
        // enter a value in Text box 2 
        selenium.type("css=input[name=\"cpar2\"]", "200");  
        // Click Calculate button
        // verify if the result is 5 
        String result = selenium.getText(".//*[@id='content']/p[2]"); 
        if (result == "40"){
	    } else { 

Now, execute the script by clicking 'Run' Button.

selenium remote control

The script would start executing and user would be able to see the command history under 'Command History' Tab.

selenium remote cotrol

The percentage is calculated and displayed the result on screen as shown below –

selenium remote control

The test output is printed on the Eclipse console as shown below. In real time the output is written to an HTML file or in a simple Text file.

Project Image