easierbycode
1/26/2012 - 12:44 AM

Selenium 2 via Sauce - IE7 on XP

Selenium 2 via Sauce - IE7 on XP

#!/usr/bin/env ruby

require 'rubygems'
require 'selenium-webdriver'

sauce_username = ENV['SAUCE_USERNAME'] || 'YOUR_SAUCE_USERNAME'
sauce_api_key = ENV['SAUCE_API_KEY'] || 'YOUR_SAUCE_API_KEY'

caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer
caps.version = "7"
caps.platform = :XP
caps[:name] = "Selenium 2 via Sauce - IE7 on XP"

driver = Selenium::WebDriver.for(
  :remote,
  :url => "http://#{sauce_username}:#{sauce_api_key}@ondemand.saucelabs.com:80/wd/hub",
  :desired_capabilities => caps)
driver.navigate.to "http://www.theautomatedtester.co.uk/demo1.html"
element = driver.find_element(:id, 'tutorial')

driver.action.click_and_hold(element).move_by(-40, -60).move_by(30, 20).move_by(100, 200).release.perform

driver.save_screenshot('ie7_screenie.png')
driver.quit