Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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