This file contains 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
>>prompt("enter!") | |
"info" | |
>>prompt("cancel!") | |
null | |
>>confirm("yes!") | |
true | |
>>confirm("no!") | |
false |
This file contains 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
# don't return anything for alert | |
browser.execute_script("window.alert = function() {}") | |
# return some string for prompt to simulate user entering it | |
browser.execute_script("window.prompt = function() {return 'my name'}") | |
# return null for prompt to simulate clicking Cancel | |
browser.execute_script("window.prompt = function() {return null}") | |
# return true for confirm to simulate clicking OK | |
browser.execute_script("window.confirm = function() {return true}") | |
# return false for confirm to simulate clicking Cancel | |
browser.execute_script("window.confirm = function() {return false}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment