selenium-google-code-issue-archive
selenium-google-code-issue-archive copied to clipboard
Cannot interact with beforeUnload dialog when closing last IE window
Originally reported on Google Code with ID 7895
If a page would open a beforeUnload dialog when closing, the InternetExplorerDriver.close()
command attempts to close the browser and then throws an exception for any other commands
sent to the browser. The browser with the dialog is left open.
Using the sample HTML:
<html><body>
<script>
window.onbeforeunload = function() {
return 'You have unsaved changes!';
}
</script>
</body></html>
Run code like the following:
driver.get("<url-to-sample-page>");
driver.close();
WebDriverWait wait = new WebDriverWait(driver, 2);
wait.until(ExpectedConditions.alertIsPresent());
driver.switchTo().alert().accept();
Expected behavior:
All lines of code should run, no exception should be thrown. The dialog should be accepted
and the browser should then close.
Actual behavior:
An exception is thrown when trying to test if the alert is present:
org.openqa.selenium.remote.SessionNotFoundException: session 30ecd2a6-b8bd-4eff-bd2e-57b803a61bdd
does not exist
Command duration or timeout: 0 milliseconds
The browser is left open with the dialog showing.
Selenium version: 2.42.2
OS: WebKing 7 64-bit (Windows NT 6.1 SP1 x86_64)
Browser: Internet Explorer
Browser version: 11.0.9600.17280
Reported by para.selenium.bugs on 2014-09-15 10:01:18
Reported by barancev on 2014-09-15 15:40:23
- Labels added: Browser-IE
Reported by luke.semerau on 2015-09-17 17:47:05
- Labels added: Restrict-AddIssueComment-Commit