Using Selenium WebDriver in a Node.js app, I am trying to handle (ignore) any alerts that may be open in a web page. For that, I add the "unexpectedAlertBehaviour" capability to my driver with the "ignore" value, as per the documentation:
var caps = { browserName: 'chrome', unexpectedAlertBehaviour: 'ignore' };
var driver = new webdriver.Builder()
.forBrowser('Chrome')
.withCapabilities(caps)
.build();However, when I run my script with a page that displays an alert, I get an exception:
UnexpectedAlertOpenError: unexpected alert open: {Alert text : This is an alert}
How can I overcome this? To be clear, I do not want to automatically accept the alert, just wait for it to be closed.
Thanks!
RP