Skip to content

Instantly share code, notes, and snippets.

@gcirne
Created April 25, 2009 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gcirne/101783 to your computer and use it in GitHub Desktop.
Save gcirne/101783 to your computer and use it in GitHub Desktop.
Testing ajax call with watir
wait { browser.div(:id, 'id').text.should include 'Some Message' }
def wait(&block)
begin
Timeout::timeout(15) do
while not block_successful?(&block)
sleep 0.5
end
end
rescue Timeout::Error
raise @exception
end
end
def block_successful?
begin
return yield
rescue => e
@exception = e
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment