Wednesday, October 7, 2009

Installing Ruby and Selenium on Windows

Though Ruby is primarily used on *nix and Mac OS X, I wanted to run it on Windows. So I went about setting up a ruby instance on Windows with the aim of writing web application tests using Selenium.

Aim: To set up Ruby and Selenium on Windows to be able to run Selenium based tests against a web application

There is a lot of information out there, but its in bits and pieces for Windows. So here is an attempt to make this a one stop resource for setting up Ruby and Selenium on Windows.


Since Selenium server needs to be started from the provided jar, you will need to have a JRE on your Windows machine.

Getting and installing Ruby on Windows:
  • Go to the following site

  • Download the latest Ruby Installer for windows. Example - ruby186-27_rc2.exe

  • Run this file to install Ruby.

  • When installing you will get to see options that need to be installed. Ensure that you select ‘Enable RubyGems’ to be installed. See screen shot. Click Next.

  • Install Ruby in a top level directory like C:\Ruby as per screen shot. Click Next.


  • Accept defaults on rest of the screens and complete the installation.

Installing the Ruby Selenium Gem on Windows
  • Go to the following site

  • Navigate to the Downloads section ( or go to the latest builds here and download the latest version.

    Example – Selenium-1.1.16.gem

  • Save this file to the “C:\Ruby” directory where you installed Ruby for Windows

  • Now start a command prompt and go to C:\Ruby

  • Type the command C:\Ruby>gem install Selenium

  • Wait for the Selenium gem to be installed.

  • Note that Selenium should be with uppercase S and not lowercase s. See screen shot.


Installing Selenium Remote Control for Windows

Selenium Remote Control (RC) is required so that the Selenium Jetty Server can start running and then tests written in Ruby can be run against the web application under test using Selenium Ruby Client driver.

Tests can be executed against any Windows browser like Internet Explorer and FireFox.

  • Go to the following site and download the latest Selenium RC driver

  • Example – Selenium RC 1.0.1

  • Extract this zip file

  • Copy only the following two folders to the C:\Ruby folder. Refer screen shot.

      1. selenium-server-1.0.1

      2. selenium-ruby-client-driver-1.0.1


    • Now go to the folder C:\Ruby\selenium-server-1.0.1

    • Copy the selenium-server.jar file from here to the following location


    • In short locate the directory where Ruby Gems are installed <GEM_INSTALL_DIR>\Selenium-1.1.16\lib\selenium\openqa

    You are done with all installations! Now the next step is to run the Selenium RC via the Jetty Server bundled with Selenium. I will post about this later on.

    No comments:

    Post a Comment