Created
October 13, 2012 01:04
-
-
Save bbugh/3882746 to your computer and use it in GitHub Desktop.
Accessing alert box in JavaScript with Capybara/rails/rspec
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
//Get a reference to the alert using the following: | |
alert = page.driver.browser.switch_to.alert | |
// and then hit OK with | |
page.driver.browser.switch_to.alert.accept | |
// or dismiss it with | |
page.driver.browser.switch_to.alert.dismiss | |
// or get the text with | |
page.driver.browser.switch_to.alert.text |
page.driver.browser.switch_to.alert.accept
and
page.driver.browser.switch_to.alert.dismiss
worked for me
works for me
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tried the same but it is throwing below error.
`assert_ok': No alert is present (Selenium::WebDriver::Error::NoAlertPresentError)