How to run Selenium RC with Ruby codes

1. Download seleniumRC from –> http://seleniumhq.org

2. Unzip the file

3. commans prompt>java -version  –> Version should grater than 1.6.0_5

4. command prompt go to –> C:\selenium-remote-control-1.0.1\selenium-server-1.0.1>java -jar  selenium-server.jar

Now Selenium runs on 4444 port.

5.  a)Download and install Ruby from http://ruby-lang.org/en/downloads/

b) cmd prompt>gem install selenium-client

or

i) Go to http://rubygems.org/gems/selenium-client

ii) Click Download and save the GEM file in C:\ruby\bin\

iii) Cmd Propmt –> C:\ruby\bin>gem install GEMNAME

 

6. Open new command prompt and goto ruby program path.In Ex, c:\test>ruby code.rb

7.  code.rb

require “selenium/client”
require “test/unit”

class Untitled < Test::Unit::TestCase
def setup
@verification_errors = []
if $selenium
@selenium = $selenium
else
@selenium = Selenium::Client::Driver.new(“localhost”, 4444, “*chrome”, “http://jazzez.wordpress.com/&#8221;, 10000);
@selenium.start
end
@selenium.set_context(“test_untitled”)
end

def teardown
@selenium.stop unless $selenium
assert_equal [], @verification_errors
end

def test_untitled
@selenium.open “/”
@selenium.click “link=jazzez-news.exe released (using Mechanize – ruby gem)”
@selenium.wait_for_page_to_load “30000″
@selenium.click “link=exact:http://bit.ly/j_news_demo&#8221;
end
end

8. Selenium RC will give some outputs in new firefox window.

Any more details need then just ping me at jazzezravi@gmail.com