Created
October 21, 2011 05:30
-
-
Save nashby/1303163 to your computer and use it in GitHub Desktop.
enter to prompt in capybara
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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