So I am on an edit page and when I click the cancel button to stay on the edit page the IE driver automatically accepts the leave page in alert pop up. I even added the IE capabilities saying:

options = new ie.Options();

But it still auto-accepts the alert dialog. Is there a way I can stop this behavior?

1 Answer 1


If you read through the NOTE section of the dismiss action in webdriver https://www.w3.org/TR/webdriver/#dismiss-alert - says

A request to dismiss an alert user prompt, which may not necessarily have a dismiss button, has the same effect as accepting it.

Could you please try out 2 things?

  1. Try the same event on a different browser and see the result.
  2. Talk to the developer and figure out if there is a dismiss event associated with the CANCEL button, if not add it. (I guess this could be the case)

This should have been a comment as it requires some action on your end and the solution might vary based on your findings, but due to the limitation on the words I am writing this as a solution.

  • It works in Chrome, but I wanna make it work in IE 11. Developer says there is no dismiss event associated with the Cancel Button. For some reason, when I hit Cancel button it takes me back to the Main Page which I dont want. It seems like IE driver automatically closes the dialog. And the setAlertBehavior is set to "ignore", but still accepts the dialog Oct 3, 2019 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.