Created
September 25, 2011 16:52
-
-
Save nowk/1240831 to your computer and use it in GitHub Desktop.
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 intercept_alert(confirm = false) | |
begin | |
# TODO dismiss vs accept | |
# page.evaluate_script('window.confirm = function(msg) { return true; }') | |
# page.driver.browser.switch_to.alert.accept | |
page.driver.browser.switch_to.alert.dismiss | |
rescue Selenium::WebDriver::Error::NoAlertOpenError | |
# / | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Had issues with Selenium
unresponsive script
alerts that kept popping up. This caused the feature to timeout and fail the test due to timeout errors.Call
intercept_alert
before the areas of trouble. Have not seen multipleunresponsive script
alerts, so not sure what the affect on that context would be.*note, most of my problems with the
unresponsive script
have been with chained javascript tests, where multiple ajax requests may be involved.Also, changing the max-timeouts in
about:config
for Firefox did not help, as some suggested.