How to run Selenium RC with Ruby codes
October 12, 2009
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/”, 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”
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
December 26, 2009 at 7:22 am
HI
I am Naveen.I had learnt ,how to run selenium IDE & selenium RC.The main thing is how to generate a Test Report after the running the test Succesfully.And another thing is How to run Selenium Core and when it is useful .And suggest me some more open source tools for testing .Net and Java Projects ………………………..
Try to help me…..
Thanks
Naveen
April 10, 2010 at 12:08 am
Hi Ravee,
It is really nice to know the difference and advantage between Watir and Selenium.
Thank you for your hard work and info sharing.
Wish you the very best!
June 4, 2010 at 5:34 am
hi ravee,
Can you help me? How to change “def test_untitled” to some other name eg. def my_test
How to define multiple tests and set their context in a single test.
January 26, 2011 at 2:48 am
Hi all,
I’m studying Selenium RC that use by Ruby.
When I run “java -jar selenium-server.jar” command. It shows warning as
“Failed to start: SocketListener0@0.0.0.0:4444
Exception in thread “main” java.net.BindException: Selenium is already running on port 4444. Or some other service is.”
From the warning, it could work or not.
Thank you so much.
January 31, 2011 at 9:07 am
Hi,
Please try with “java -jar selenium-server.jar -p 5555″
Thanks