K
Kga Agk
Is it posible to make a ruby file that runs test that uses selenium.
This code is from the selenium ide (Only somthing don in a hurry):
require "selenium"
require "test/unit"
class Untitled < Test::Unit::TestCase
def setup
@verification_errors = []
if $selenium
@selenium = $selenium
else
@selenium = Selenium::SeleniumDriver.new("localhost", 4444,
"*chrome", "http://change-this-to-the-site-you-are-testing/", 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=Documentation"
@selenium.wait_for_page_to_load "30000"
@selenium.click "//div[@id='selenium-documentation']/ul[1]/li[1]/a"
@selenium.wait_for_page_to_load "30000"
assert @selenium.is_text_present("welcome")
end
end
Would it be posible to runn this code inside eclipse, or from the
command line?
I have tried:
gem install selenium-client
gem install Selenium
gem install selenium-rails
I have also tryed to download selenium RC and placed it in my app
folder. And made a selenium.rb that point in to it. Somthing like this
http://siannopollo.blogspot.com/2007/02/selenium-and-ruby-they-actually-work.html
But I am notetierly sure if I did this corectly.
If it is posible, do anyone have a clear and easy description of how to
get it to work. And including a example file with requier files and all?
This code is from the selenium ide (Only somthing don in a hurry):
require "selenium"
require "test/unit"
class Untitled < Test::Unit::TestCase
def setup
@verification_errors = []
if $selenium
@selenium = $selenium
else
@selenium = Selenium::SeleniumDriver.new("localhost", 4444,
"*chrome", "http://change-this-to-the-site-you-are-testing/", 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=Documentation"
@selenium.wait_for_page_to_load "30000"
@selenium.click "//div[@id='selenium-documentation']/ul[1]/li[1]/a"
@selenium.wait_for_page_to_load "30000"
assert @selenium.is_text_present("welcome")
end
end
Would it be posible to runn this code inside eclipse, or from the
command line?
I have tried:
gem install selenium-client
gem install Selenium
gem install selenium-rails
I have also tryed to download selenium RC and placed it in my app
folder. And made a selenium.rb that point in to it. Somthing like this
http://siannopollo.blogspot.com/2007/02/selenium-and-ruby-they-actually-work.html
But I am notetierly sure if I did this corectly.
If it is posible, do anyone have a clear and easy description of how to
get it to work. And including a example file with requier files and all?