Skip to content
This repository has been archived by the owner. It is now read-only.

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

Open
lukeis opened this issue Mar 4, 2016 · 2 comments
Open

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

lukeis opened this issue Mar 4, 2016 · 2 comments

Comments

@lukeis
Copy link
Member

@lukeis lukeis commented Mar 4, 2016

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

@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 4, 2016

Reported by barancev on 2014-09-15 15:40:23

  • Labels added: Browser-IE
@lukeis

This comment has been minimized.

Copy link
Member Author

@lukeis lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 17:47:05

  • Labels added: Restrict-AddIssueComment-Commit
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
1 participant
You can’t perform that action at this time.