Selenium-RC: How it works

How Selenium Remote Control works

The Selenium Server communicates directly with the browser using AJAX (XmlHttpRequest). You can send commands directly to the Server using simple HTTP GET/POST requests; that means that you can use any programming language that can make HTTP requests to automate Selenium tests on the browser. To further ease this process, we provide wrapper objects for a number of mainstream programming languages (Java, .NET, Perl, Python, and Ruby).

Finally, the Selenium Server acts as a client-configured HTTP proxy, to stand in between the browser and your website. This allows a Selenium-enabled browser to run JavaScript on arbitrary websites.

Here is an architectural diagram.

rc arch diagram
As a test suite starts in your favorite language, the following happens
  1. The client/driver reaches out to the selenium-server.
  2. Selenium-Server launches a browser (or reuses an old one) with a URL that will load Selenium core web page.
  3. Selenium-Core gets the first instruction from the client/driver (via the HTTP Proxy built into the Selenium RC Server.
  4. Selenim-Core acts on that first instruction, typlically opening a page of the AUT.
  5. the web server is asked for that page, and it renders in the frame/window reserved for it.

Variations 

Some teams choose to have the web server launched in the same process that is driving the tests.  That will most likely mean that the web-app technology is compatible with the testing logic.  JSP and JUnit for example.