Skip to content

Instantly share code, notes, and snippets.

@jarib
Created February 9, 2012 19:29
Show Gist options
  • Save jarib/1782269 to your computer and use it in GitHub Desktop.
Save jarib/1782269 to your computer and use it in GitHub Desktop.
require 'selenium/webdriver'
driver = Selenium::WebDriver.for :firefox
driver.get "http://jqueryui.com/demos/slider/range.html"
amount = driver.find_element(:id => "amount")
left, right = driver.find_elements(:class => "ui-slider-handle")
driver.action.click_and_hold(left).perform
until amount[:value].include? "150"
p :amount => amount[:value]
driver.action.move_by(5, 0).perform
end
driver.action.release
driver.action.click_and_hold(right).perform
until amount[:value].include? "280"
p :amount => amount[:value]
driver.action.move_by(-5, 0).perform
end
driver.action.release
p amount[:value]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment