views:

100

answers:

0

I have a webpage that uses onbeforeunload to prompt the user for confirmation whenever they try and navigate away from the page. This confirmation even fires when the browser window is closed.

My problem is that this prompt is preventing Watir from closing IE at the end of a test run, at least until I manually intervene and click "OK".

How can I write my tests such that Watir automatically dismisses this prompt, even if the test fails? I'm thinking there might be some conditional logic in the test teardown method, but I need help interacting with the popup.

Note: I have a different question pertaining to interacting with the onbeforeunload prompt when it is created by a click event. This question is about handling that popup when it is created by a request to close the window.