Practical 14: Selenium RC Tools
Aim
Set up the Selenium RC (Remote Control) environment used in this exercise. Write a test for a registration form. Run it and check the test results, server logs and screenshot.
Theory
Selenium RC (Remote Control) is an older Selenium tool. A test program sends commands to an RC server. That server controls the browser using JavaScript.
This extra server sits between the test and the browser. Study it to understand older test code and compare its design with WebDriver.
Your Java test cannot talk to the browser directly, so it gives orders to a translator (the RC server). The translator sneaks a small JavaScript helper (Selenium Core) into the web page, and that helper presses the buttons. It works, but it is slower and sometimes blocked by browser security – which is why the modern WebDriver talks to the browser directly.
flowchart LR
T[Test program<br/>Java + selenium-java-client-driver] -- HTTP commands --> S[Selenium RC Server<br/>localhost:4444]
S -- launches & injects --> C[Selenium Core<br/>JavaScript in the browser]
S -- HTTP proxy --> B[Browser]
C --> AUT[Application under test]
B --> AUT
| Component | Role |
|---|---|
| Client libraries | Language bindings (DefaultSelenium class) that send Selenese commands over HTTP (Hypertext Transfer Protocol) |
| Selenium RC Server | Java server (selenium-server-standalone-2.x.jar, port 4444) that launches browsers, acts as an HTTP proxy and injects Selenium Core |
| Selenium Core | JavaScript that runs commands inside the page |
Because RC injected JavaScript, it was subject to the browser’s same-origin policy – the proxy made the AUT (Application Under Test) appear to come from the same origin as Selenium Core.
Selenium RC vs WebDriver
| Selenium RC (Selenium 1) | Selenium WebDriver (Selenium 2+) |
|---|---|
| Needs the RC server running | Talks directly to the browser through a driver |
| JavaScript injection – slower | Native browser automation – faster |
| Uses a proxy to work around page-script restrictions | Uses browser automation commands; page scripts still follow browser security rules |
| Limited support for modern browsers | Supports Chrome, Firefox, Edge, Safari |
DefaultSelenium API (Application Programming Interface) (selenium.type, selenium.click) |
Object-oriented WebDriver/WebElement API |
| Deprecated, removed in Selenium 3 | W3C (World Wide Web Consortium) standard (2018) |
Selenium 3+ removed RC. Some Selenium 2/3 legacy packages provide WebDriverBackedSelenium, which implements the old RC API on top of WebDriver. The RC server JAR (Java Archive) selenium-server-standalone-2.53.1.jar and Firefox ESR (Extended Support Release) 45/47 are used for historical labs. The concepts (server, client, Selenese commands) still appear in exams.
Common Selenium RC commands (DefaultSelenium API)
| Method | Action |
|---|---|
start() / stop() |
Start / end the browser session |
open(url) |
Open a page |
type(locator, text) |
Type into a field |
click(locator) |
Click |
select(locator, "label=India") |
Choose a drop-down option |
check(locator) |
Tick a checkbox |
waitForPageToLoad("30000") |
Wait for navigation |
isTextPresent(text) |
Is the text anywhere on the page? |
isElementPresent(locator) |
Does the element exist? |
getText(locator), getTitle(), getValue(locator) |
Read values |
captureScreenshot(file) |
Screenshot |
Requirements
The .test addresses refer to the simulated practice app. Outside the simulator, use a running test app and its actual addresses and page elements.
- JDK (Java Development Kit) 8 and an isolated, instructor-provided legacy setup; Eclipse. Use the browser and library versions supplied with that setup, not a current browser.
selenium-server-standalone-2.53.1.jar(contains RC server + client) and JUnit 4.- Firefox ESR (for real RC) – or the virtual lab, which simulates the RC server and browser.
- Application under test: VLP Demo Store registration page
https://demo.virtuallp.test/registerwith fields Full name, Email, Mobile, Password, Confirm password, Country, Accept terms.
Procedure
Part A – Set up the RC environment
- Download
selenium-server-standalone-2.53.1.jartoC:\selenium. - Start the RC server in a Command Prompt:
C:\selenium> java -jar selenium-server-standalone-2.53.1.jar -port 4444
10:31:05.123 INFO - Launching a standalone Selenium Server
10:31:05.410 INFO - Java: Oracle Corporation 25.401-b10
10:31:05.411 INFO - OS: Windows 10 10.0 amd64
10:31:05.432 INFO - v2.53.1, with Core v2.53.1. Built from revision a36b8b1
10:31:05.620 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
10:31:05.625 INFO - Selenium Server is up and running
- In Eclipse create a Java project
SeleniumRCLab, addselenium-server-standalone-2.53.1.jarand JUnit 4 to the build path.
Part B – Write the registration test
package vlp.rc;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class RegistrationRCTest {
private Selenium selenium;
@Before
public void setUp() {
// host, port of RC server, browser launcher, base URL of the AUT
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "https://demo.virtuallp.test/");
selenium.start();
selenium.windowMaximize();
}
@Test
public void registerNewUser() {
selenium.open("/register");
selenium.waitForPageToLoad("30000");
assertEquals("Register – VLP Demo Store", selenium.getTitle());
selenium.type("id=fullName", "Priya Sharma");
selenium.type("id=email", "priya.sharma@example.com");
selenium.type("id=mobile", "9876543210");
selenium.type("id=password", "Secret@123");
selenium.type("id=confirmPassword", "Secret@123");
selenium.select("id=country", "label=India");
selenium.check("id=terms");
selenium.click("css=button[type='submit']");
selenium.waitForPageToLoad("30000");
assertTrue(selenium.isTextPresent("Registration successful"));
assertEquals("Priya Sharma", selenium.getText("css=.profile-name"));
selenium.captureScreenshot("C:\\selenium\\registration-success.png");
}
@Test
public void passwordsMustMatch() {
selenium.open("/register");
selenium.waitForPageToLoad("30000");
selenium.type("id=fullName", "Test User");
selenium.type("id=email", "test@example.com");
selenium.type("id=mobile", "9876500000");
selenium.type("id=password", "Secret@123");
selenium.type("id=confirmPassword", "Different@1");
selenium.check("id=terms");
selenium.click("css=button[type='submit']");
assertTrue(selenium.isElementPresent("css=.error"));
assertEquals("Passwords do not match", selenium.getText("css=.error"));
}
@After
public void tearDown() {
selenium.stop();
}
}
Part C – Execute and verify
- Ensure the RC server is running.
- Right-click the class → Run As → JUnit Test.
- Watch Firefox open, the form being filled automatically, and the result page.
- Check the JUnit view (green bar = pass) and the server console log:
10:33:12.501 INFO - Command request: getNewBrowserSession[*firefox, https://demo.virtuallp.test/] on session null
10:33:15.884 INFO - Got result: OK,7f2c… on session 7f2c…
10:33:15.902 INFO - Command request: open[/register, ] on session 7f2c…
10:33:16.711 INFO - Command request: type[id=fullName, Priya Sharma] on session 7f2c…
...
10:33:18.210 INFO - Command request: isTextPresent[Registration successful, ] on session 7f2c…
10:33:18.225 INFO - Got result: OK,true on session 7f2c…
10:33:18.540 INFO - Command request: testComplete[, ] on session 7f2c…
- Open
registration-success.pngto confirm the visual result.
Running RC code on modern Selenium (WebDriverBackedSelenium)
WebDriver driver = new FirefoxDriver();
Selenium selenium = new WebDriverBackedSelenium(driver, "https://demo.virtuallp.test/");
selenium.open("/register"); // same RC API, executed by WebDriver
Virtual lab · Testing Tools · 25 min
Selenium Remote Control: server + registration test
Start the Selenium RC server from the command prompt, run a JUnit test that uses the classic DefaultSelenium API to fill the registration form, and follow every Selenese command in the server log.
Output / Observations
Example output for the settings in this lesson:
- JUnit: Runs: 2/2, Errors: 0, Failures: 0.
- The RC server log lists every Selenese command and its result for the session.
- The negative test confirms the validation message Passwords do not match.
Conclusion
Check the form result and the JUnit checks. Read the RC server logs and save the screenshot. Explain the role of the RC server and how this differs from WebDriver.
Viva questions
- Explain the architecture of Selenium RC. Test code (client library) → RC server → Selenium Core JavaScript injected into the browser → web application.
- What is the role of the Selenium RC server? On which port does it run by default? It launches the browser, injects Selenium Core and relays commands as an HTTP proxy; default port 4444.
- What is Selenium Core? The JavaScript engine that runs inside the page and performs the Selenese commands.
- Why did RC need a proxy (same-origin policy)? Browsers block JavaScript from one site controlling another; the proxy makes Selenium Core look as if it came from the site under test.
- Explain
DefaultSeleniumconstructor parameters. Server host, server port, browser launcher (for example*firefox) and the base URL (Uniform Resource Locator) of the application. - Compare Selenium RC and WebDriver. RC needs a server and uses injected JavaScript (slower, deprecated); WebDriver drives the browser natively through a driver (faster, current standard).
- What is
WebDriverBackedSelenium? A bridge that runs old RC-style (SeleniumAPI) code on top of WebDriver, used for migration.
Practise this topic
Hands-on virtual lab
Apply what you just read in a realistic, guided simulation. Free with a verified account.
Create a free account to track your progress and unlock virtual labs.