Skip to content

Instantly share code, notes, and snippets.

@bramhaghosh
Created July 25, 2011 14:27
Show Gist options
  • Select an option

  • Save bramhaghosh/1104236 to your computer and use it in GitHub Desktop.

Select an option

Save bramhaghosh/1104236 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Jul 25, 2011.
    21 changes: 21 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    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