Selenium Grid

22 Apr 2011 by

Selenium Grid Architecture

Selenium Grid Architecture

Selenium is a fantastic web application testing package that comes with different form factors such as Selenium IDE, Selenium Remote Control (RC), Selenium WebDriver and finally Selenium Grid. It highly depends on quality assurance to choose whichever appropriated. This article we see Selenium Grid as it is a good example of distributed systems.

What is Selenium Grid actually?

In distributed systems, Cloud computing is usually running on homogeneous platform while Grid computing is running heterogeneous platform. Similarly, Selenium Grid is running on different (heterogeneous) platform, support various programming languages, support multiples unit test framework, and more importantly is cross browsers.


Selenium Grid consists of 2 main parts:

  • Selenium Hub: the main coordinator of all Selenium Remote Control. When we start developing testing, we only point to Selenium Hub IP address. With appropriated mentioned environment, Selenium Hub will forward the request to specific environment in Selenium Remote Control. The example of environments are: *firefox, “Firefox on Linux”, “Firefox on Windows”, *safari, etc.
  • Selenium Remote Control (RC): the server that will invoke browser to be under test. It receive the command from Selenium Hub

How to Start?

  • Start Selenium Hub
    • $ ant launch-hub
  • Start Selenium Remote Control (RC)
    • $ ant -Dhost=IP_of_RC -Dport=5555 -DhubURL=http://IP_of_Hub:4444 -Denvironment="Firefox on Linux" launch-remote-control
  • Run Test from NUnit in C#. The code is exactly the same of old Selenium Remote Control (RC)
  • Selenium Grid web monitoring console
    • http://IP_of_Hub:4444/console

Source Code in NUnit and C#

using System;
using System.Text;
using NUnit.Framework;
using Selenium;

namespace SeleniumTests
    public class Lycog
        private ISelenium _selenium;
        private StringBuilder _verificationErrors;

        public void SetupTest()
            _selenium = new DefaultSelenium("", 4444, "Firefox on Windows", "");
            _verificationErrors = new StringBuilder();

        public void TeardownTest()
            catch (Exception)
            Assert.AreEqual("", _verificationErrors.ToString());

        public void SearchMooreLaw()
          _selenium.Type("s", "selenium");
          Assert.IsTrue(_selenium.IsElementPresent("link=Web Application Testing System – Selenium"));


No responses yet

Leave a Reply

Time limit is exhausted. Please reload the CAPTCHA.