Introduction To Selenium RC: Brief History of The Selenium Project
Introduction To Selenium RC: Brief History of The Selenium Project
As you can read in Brief History of The Selenium Project, Selenium RC was
the main Selenium project for a long time, before the WebDriver/Selenium merge
brought up Selenium 2, the newest and more powerful tool.
Selenium 1 is still actively supported (mostly in maintenance mode) and
provides some features that may not be available in Selenium 2 for a while,
including support for several languages (Java, Javascript, Ruby, PHP, Python, Perl
and C#) and support for almost every browser out there.
The diagram shows the client libraries communicate with the Server
passing each Selenium command for execution. Then the server passes the
Selenium command to the browser using Selenium-Core JavaScript commands.
The browser, using its JavaScript interpreter, executes the Selenium command.
This runs the Selenese action or verification you specified in your test script.
Selenium Server
Selenium Server receives Selenium commands from your test program,
interprets them, and reports back to your program the results of running those
tests.
The RC server bundles Selenium Core and automatically injects it into the
browser. This occurs when your test program opens the browser (using a client
library API function). Selenium-Core is a JavaScript program, actually a set of
JavaScript functions which interprets and executes Selenese commands using
the browsers built-in JavaScript interpreter.
The Server receives the Selenese commands from your test program using
simple HTTP GET/POST requests. This means you can use any programming
language that can send HTTP requests to automate Selenium tests on the
browser.
Client Libraries
The client libraries provide the programming support that allows you to
run Selenium commands from a program of your own design. There is a different
client library for each supported language. A Selenium client library provides a
programming interface (API), i.e., a set of functions, which run Selenium
commands from your own program. Within each interface, there is a
programming function that supports each Selenese command.
The client library takes a Selenese command and passes it to the Selenium
Server for processing a specific action or test against the application under test
(AUT). The client library also receives the result of that command and passes it
back to your program. Your program can receive the result and store it into a
program variable and report it as a success or failure, or possibly take corrective
action if it was an unexpected error.
So to create a test program, you simply write a program that runs a set of
Selenium commands using a client library API. And, optionally, if you already
have a Selenese test script created in the Selenium- IDE, you can generate the
Selenium RC code. The Selenium-IDE can translate (using its Export menu item)
its Selenium commands into a client-drivers API function calls. See the
Selenium-IDE chapter for specifics on exporting RC code from Selenium-IDE.
Installation
Installation is rather a misnomer for Selenium. Selenium has set of libraries
available in the programming language of your choice. You could download them
from downloads page.
Once youve chosen a language to work with, you simply need to:
o
o
The primary task for using Selenium RC is to convert your Selenese into a
programming language. In this section, we provide several different languagespecific examples.
C#
PHP
Pytho
n
Perl
Ruby
Java
For Java, people use either JUnit or TestNG as the test engine. Some
development environments like Eclipse have direct support for these via plug-ins.
This makes it even easier. Teaching JUnit or TestNG is beyond the scope of this
document however materials may be found online and there are publications
available. If you are already a java-shop chances are your developers will
already have some experience with one of these test frameworks.
You will probably want to rename the test class from NewTest to
something of your own choosing. Also, you will need to change the browseropen parameters in the statement: