Skip to content

Instantly share code, notes, and snippets.

@jeffmcfadden
Last active July 21, 2017 17:20
Show Gist options
  • Save jeffmcfadden/ea0e867bcc310316afdd1a05f1ec0456 to your computer and use it in GitHub Desktop.
Save jeffmcfadden/ea0e867bcc310316afdd1a05f1ec0456 to your computer and use it in GitHub Desktop.
require 'watir'
browser = Watir::Browser.new
while true do
begin
browser.goto "http://www.radiotimes.com/news/2017-07-21/radio-times-radio-and-podcast-champion-round-4-5"
sleep 1
puts "Clicking Brady Haran"
browser.radio(name: "PDI_answer9793268", value: "44802685" ).set
sleep 1
puts "Clicking Vote"
browser.link(id: 'pd-vote-button9793268').click
sleep 1
rescue Selenium::WebDriver::Error::UnhandledAlertError
puts "Clicking OK on alert"
browser.alert.ok
rescue StandardError => err
puts "Error: #{err}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment