I'm running WebDriver tests in Ruby and I've got a problem with closing Internet Explorer browser: when I suppose to close browser's window, IE pop-ups with the prompt "Are you sure want to leave this page" and two options are available "Leave this page" and "Stay on this page".
I've tried several methods for closing browser, both without success:
driver.quit
driver.close
Also WebDriver doesn't recognize this pop-up as JavaScript pop-up so
driver.alert.ok
driver.switch_to.alert
methods are also not applicable. I'm using IE9 and IEDriverServerx86 v. 2.24.2
I appreciate any help you can provide
You need to suppress the onbeforeunload event first:
driver.execute_script "window.onbeforeunload = function(e){};"
driver.quit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With