Skip to content

Instantly share code, notes, and snippets.

@bramhaghosh
Created July 25, 2011 14:27
Show Gist options
  • Save bramhaghosh/1104236 to your computer and use it in GitHub Desktop.
Save bramhaghosh/1104236 to your computer and use it in GitHub Desktop.
def checkbox(name, identifier)
define_method("#{name}") do
send("#{name}_rendered?")
browser.checkbox(identifier)
end
define_method("check_#{name}") do
send("#{name}_rendered?")
times_retried = 0
begin
browser.checkbox(identifier).set
rescue WIN32OLERuntimeError,
Watir::Exception::ObjectDisabledException,
Watir::Exception::NoValueFoundException,
Watir::Exception::UnknownObjectException => exception
raise exception if times_retried >= 5
sleep 1
times_retried += 1
retry
end
end
define_method("unchec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment