Reputation: 400
I recently discovered Selenium Grid 2. I have used Grid, IDE and RC before, for which writing tests was pretty trivial, especially with the original Grid. (maybe because I never used web-driver?)
Grid 2 documentation is still pretty flaky regarding writing actual tests.
Can anyone get me started with Ruby tests? Perhaps just a simple example would do.
Also what about DeepTest integration with Grid 2... or something similar.
Thanks in advance.
Upvotes: 2
Views: 2530
Reputation: 400
For anyone who might be interested, the tests would be in this kind of format:
require "rubygems"
require "selenium-webdriver"
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => :firefox)
driver.get "http://google.co.uk/"
driver.find_element(:id, "lst-ib").clear
driver.find_element(:id, "lst-ib").send_keys "selenium 2 webdriver"
driver.find_element(:xpath, "//ol[@id='rso']/li/div/span/h3/a/em[3]").click
driver.find_element(:link, "Selenium").click
driver.find_element(:id, "q").clear
driver.find_element(:id, "q").send_keys "grid2"
driver.find_element(:id, "submit").click
driver.quit
The test is meant to be run remotely, if you want to run it locally then change:
from
driver = Selenium::WebDriver.for(:remote, :desired_capabilities => :firefox)
to
driver = Selenium::WebDriver.for(:firefox)
http://code.google.com/p/selenium/wiki/RubyBindings is a good reference for all this.
Upvotes: 3