I am trying to automate a scenario in which the User closes the browser's tab or the browser itself. The User is expected to be prompted with an alert
when doing so along the lines of Are you sure you want to leave?
The alert
is displayed when I manually close the tab, or the browser. However, when attempting to automate it via browser.close(), or browser.quit() or executing a script window.close()
, the alert is entirely ignored and the browser shuts down.
Is there a way to simulate the action of a closing the browser's tab?
I'm using: Protractor / Google Chrome