SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
346 stars 195 forks source link

Inconsistent exceptions on an attempt to run an operation after the browser quit #3753

Open lukeis opened 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 3753

What steps will reproduce the problem?
1. Create a new WebDriver instance.
2. Close the WebDriver instance using Close()
3. Attempt to get the Current Window Handle from the closed WebDriver instance.

For InternetExplorerDriver and the ChromeDriver, an exception is thrown.  However,InternetExplorerDriver
throws a WebDriverException, while the ChromeDriver throws a NotImplementedException.

For the Firefox Driver, the WindowHandle is returned without an exception.

I would expect that all the drivers would behave the same when attempting to retrieve
the Current Window Handle from a closed WebDriver instance, whether that be that they
all throw the same exception, or they all return the Current Window Handle.

Selenium version: 2.21 WebDriver C# Bindings.
OS: Win7
Browser: IE 9, Chrome 18, Firefox 11.

Attached is a C# Unit test that will reproduce the issue.

Reported by nathandace on 2012-04-19 15:44:41


lukeis commented 8 years ago
The problem here is in the individual driver implementations. Let's lay down some ground
rules for discussion. First, that calls to a driver instance after calling IWebDriver.Quit()
should throw an exception. Second, that drivers should conform to the JSON Wire Protocol[1].
Given that, Firefox behaves incorrectly altogether, as it should throw an exception,
because IWebDriver.Close() when there is only one window open should have the same
semantics as IWebDriver.Quit(). Chrome should be returning a simple string for its
error message in the body of the 404 HTTP response, but doesn't, returning a JSON object
instead. I'll consider working around the issue in the .NET bindings for Chrome, but
someone will have to dig into the Firefox driver to make it work with the correct semantics.

[1] http://code.google.com/p/selenium/wiki/JsonWireProtocol

Reported by james.h.evans.jr on 2012-04-24 16:06:30

lukeis commented 8 years ago

Reported by barancev on 2012-05-04 08:25:48

lukeis commented 8 years ago

Reported by barancev on 2012-11-14 13:21:54

lukeis commented 8 years ago
See tests in SessionHandlingTest test class for the current status.

Reported by barancev on 2012-11-14 13:22:35

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 17:44:49