Modal dialog present (Selenium::WebDriver::Error::UnhandledAlertError)

You are using cucumber for your tests and you would like to use the modal dialog confirmation box in a rails application, with capybara but you are getting the following error:

Modal dialog present Selenium::WebDriver::Error::UnhandledAlertError)


In your steps file use the following to accept (press OK), in the confirmation dialog that pops up:


NOTE: Or in more recent versions when the above complains for ‘undefined method wait_until’


NOTE: Taken from the second comment made here