Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

Cannot interact with beforeUnload dialog when closing last IE window #7895

Open
@lukeis

Description

@lukeis

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions