Skip to content

Instantly share code, notes, and snippets.

@nashby
Created October 21, 2011 05:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nashby/1303163 to your computer and use it in GitHub Desktop.
Save nashby/1303163 to your computer and use it in GitHub Desktop.
enter to prompt in capybara
def suppress_prompt(text)
page.evaluate_script 'window.original_prompt_function = window.prompt;'
page.evaluate_script "window.prompt = function(msg) { return '#{text}'; }"
end
def recover_prompt
page.evaluate_script('window.prompt = window.original_prompt_function;')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment