Skip to content

Instantly share code, notes, and snippets.

@jarib
Created October 13, 2010 14:56
Show Gist options
  • Select an option

  • Save jarib/624194 to your computer and use it in GitHub Desktop.

Select an option

Save jarib/624194 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'watir-webdriver'
b = Watir::Browser.new(:firefox)
b.goto('http://mysite')
b.link(:text,'Where to go').click
puts 'See all tournaments, cause by default only then are shown'
b.link(:text,'see all').click
hrefs = b.links(:class, 'pn-title').map { |link| link.href }
hrefs.each do |href|
url = 'http://mysite'+href
b.goto(url)
path = '//div/table/tr[10]/td/table/tbody/tr[4]/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/table[2]/tbody/tr/td'
b.element_by_xpath(path)
puts b.text
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment