Here are the steps that you need to follow to install and run Selenium RC using Ruby code.
1. Download the latest version of Selenium RC
2. Unzip the file save it C:\selenium-remote-control-1.0.3
3. command prompt>java -version –> Version should grater than 1.6.0_5
4. command prompt go to –> C:\selenium-remote-control-1.0.3\selenium-server-1.0.3>java -jar selenium-server.jar
5. Download the RubyInstaller – The Ruby Installer is currently available only for the Windows platform. The version that I have downloaded was Ruby 1.9.2-p0
6. Install the RubyInstaller by double slicking on the .exe file. A new Ruby folder is created in your C drive Ruby192
7. Download the selenium-client to c:\Ruby192\bin. The version I have downloaded was selenium-client 1.2.18
8. Set the CLASSPATH C:\Ruby192\bin – This is done by adding System Variables
9. Go to Cmd Prompt –> c:\Ruby192\bin>gem install selenium-client-1.2.18.gem
Once you install selenium-client you should get the following conformation message:
’1 gem installed
Installing ri documentation for selenium-client-1.2.18…
Installing RDoc documentation for selenium-client-1.2.18…
10. Open a text editor and copy the following code and save the file as googlesearch.rb under your test script folder in this example c:\seleniumrubytest
require "test/unit"
require "rubygems"
gem "selenium-client"
require "selenium/client"
class Untitled < Test::Unit::TestCase
def setup
@verification_errors = []
@selenium = Selenium::Client::Driver.new \
:host => "localhost",
:port => 4444,
:browser => "*chrome",
:url => "http://www.google.com.au/",
:timeout_in_second => 60
@selenium.start_new_browser_session
end
def teardown
@selenium.close_current_browser_session
assert_equal [], @verification_errors
end
def test_untitled
@selenium.open "/"
@selenium.type "q", "selenium wiki"
@selenium.click "btnG"
@selenium.wait_for_page_to_load "30000"
begin
assert @selenium.is_text_present("Selenium Wiki")
rescue Test::Unit::AssertionFailedError
@verification_errors << $!
end
end
end
11. Go to c:\seleniumrubytest where you have the ruby script and execute the command ruby googlesearch.rb. Also make sure that you have the Selenium RC server running.
12. The selenium script will get executed and you will see the results on the command prompt.
Loaded suite googlesearch
Started
.
Finished in 11.593750 seconds.
1 tests, 2 assertions, 0 failures, 0 errors, 0 skips
Test run options: --seed 23438
If you found this solution helpful or have something extra to add, feel free to share it here by commenting below.

Hi Pavan,
Thanks for the post, Can you also suggest efficient user interface(like Nunit for C#) for ruby where you can have all your test and run from there and analyze results
Cheers
Mallika
hi pavan, i need some more information about running selenium Rspec.
Hi All,
When I execute googlesearch.rb file, it shows error as
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Loaded suite D:/Venda/SeleniumTest/googlesearch
Started
2011-01-26 12:13:34 +0700 selenium-client received failure from selenium server:
requested:
cmd=getNewBrowserSession
1=*firefox
2=http://www.google.com.au/
3=
4=
received:
“\x00″
called from C:/Ruby192/lib/ruby/1.9.1/timeout.rb:57:in `timeout’
E
Finished in 0.031250 seconds.
1) Error:
test_untitled(Untitled):
Selenium::CommandError:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/selenium-client-1.2.18/lib/selenium/clie
nt/protocol.rb:13:in `block in remote_control_command’
1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
Test run options: –seed 22067
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
What it happen?
Thank you so much.
Tae.
Thanks for the post. This is one of the easiest explanation I have ever seen on the web after a long search. I was able to execute it without any error. The only thing I was not able to get was the result stored. I was not able to figure out where the results get stored so that I could look into to find out the execution result.
Hi,
Thanks for post.