How to test a confirm dialog with Cucumber? - Stack Overflow

Seems like there's no way to do it in Capybara, unfortunately. But if you're running your tests with the Selenium driver (and probably other drivers that support JavaScript), you can hack it

Lexy About 14 years ago