Skip to content

Instantly share code, notes, and snippets.

@leosoto
Created June 11, 2010 13:21
Show Gist options
  • Save leosoto/434460 to your computer and use it in GitHub Desktop.
Save leosoto/434460 to your computer and use it in GitHub Desktop.
def javascript_confirm(answer)
page.evaluate_script 'window._confirm = window.confirm'
page.evaluate_script "window.confirm = function(x) { return #{answer} }"
yield
page.evaluate_script 'window._confirm && (window.confirm = window._confirm)'
page.evaluate_script 'window._confirm = null'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment