Skip to content

Instantly share code, notes, and snippets.

@epall
Forked from santiycr/watir-example.rb
Created April 3, 2011 23:53
Show Gist options
  • Save epall/900941 to your computer and use it in GitHub Desktop.
Save epall/900941 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'selenium/webdriver'
require 'selenium/webdriver/remote'
require "watir-webdriver"
username = ENV['SAUCE_USERNAME']
access_key = ENV['SAUCE_ACCESS_KEY']
capabilities = {
:name => "Watir in the cloud!"
}
browsers = [
{:platform => "WINDOWS", :version => "8", :browserName => "internet explorer"},
{:platform => "WINDOWS", :version => "7", :browserName => "internet explorer"},
{:platform => "WINDOWS", :version => "6", :browserName => "internet explorer"},
{:platform => "WINDOWS", :version => "3.0", :browserName => "firefox"},
{:platform => "WINDOWS", :version => "3.5", :browserName => "firefox"},
{:platform => "WINDOWS", :version => "3.6", :browserName => "firefox"},
{:platform => "WINDOWS", :version => "", :browserName => "chrome"},
{:platform => "VISTA", :version => "4", :browserName => "firefox"},
{:platform => "VISTA", :version => "9", :browserName => "internet explorer"}
{:platform => "LINUX", :version => "3.0", :browserName => "firefox"},
{:platform => "LINUX", :version => "3.6", :browserName => "firefox"},
]
pool = []
browsers.each do |browser|
pool << Thread.new do
b = Watir::Browser.new(:remote,
:url => "http://#{username}:#{access_key}@saucelabs.com:4444/wd/hub",
:desired_capabilities => capabilities.merge(browser))
b.goto("http://google.com")
b.text_field(:name => 'q').set("Sauce Labs")
b.button(:name => 'btnG').click
puts b.title
b.close
end
end
pool.each &:join
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment