Skip to content

Instantly share code, notes, and snippets.

@paulelliott
Forked from leosoto/gist:434460
Created June 12, 2010 03:46
Show Gist options
  • Save paulelliott/435395 to your computer and use it in GitHub Desktop.
Save paulelliott/435395 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