Skip to content

Instantly share code, notes, and snippets.

@mattyoho
Forked from leosoto/gist:434460
Created June 11, 2010 13:37
Show Gist options
  • Save mattyoho/434477 to your computer and use it in GitHub Desktop.
Save mattyoho/434477 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