Skip to content

Instantly share code, notes, and snippets.

@jarib
Created June 17, 2011 15:02
Show Gist options
  • Save jarib/1031588 to your computer and use it in GitHub Desktop.
Save jarib/1031588 to your computer and use it in GitHub Desktop.
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :chrome
driver.extend Selenium::WebDriver::DriverExtensions::HasInputDevices
wait = Selenium::WebDriver::Wait.new
begin
driver.get "http://dev.sencha.com/deploy/touch/examples/kitchensink/"
wait.until { driver.all(:class => "x-list-item-body").find { |e| e.displayed? && e.text == "User Interface"} }.click
wait.until { driver.all(:class => "x-list-item-body").find { |e| e.displayed? && e.text == "List"} }.click
top = driver.all(:class => "x-list-item").find { |e| e.text == "Allan Disbrow"}
bot = driver.all(:class => "x-list-item").find { |e| e.text == "Darren Devalle"}
p :top => top.location, :bot => bot.location
driver.action.click_and_hold(top).move_by(0, -100).release.perform
p :top => top.location, :bot => bot.location
sleep 5
ensure
driver.quit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment