Before using Selenium WebDriver version 2.4.0, I used to follow the below code:
alert = page.driver.browser.switch_to.alert
But, Selenium 2.4.0 has changed "Raise in switch_to.alert when no alert is present.", so I found an Error:
No alert is present (Selenium::WebDriver::Error::NoAlertOpenError) exception.
How to check for the presence of an alert using selenium-web-driver 2.4.0?