getWindowHandles() throwing an exception

287 views
Skip to first unread message

Matt

unread,
Jun 1, 2009, 7:25:55 PM6/1/09
to webdriver
Hi there. Our automation team has been using your product for a few
months now, and we like it so far. I'm running into a problem though
in your FirefoxDriver with Firefox 3.0. I have a method that
compensates for popup windows, via the getWindowHandles() method. It
can interact with the popup just fine, but after the window closes and
we are back on the base window, it throws this error trying to call
driver.getWindowHandles():

org.openqa.selenium.WebDriverException: Expected response to
getAllWindowHandles but actually got: selectElementById
(selectElementById)

The stack trace is:

Caused by: org.openqa.selenium.WebDriverException: Expected response
to getAllWindowHandles but actually got: selectElementById
(selectElementById)
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
java.version: '1.6.0_13'
Driver info: driver.version: firefox
at
org.openqa.selenium.firefox.internal.AbstractExtensionConnection.readLoop
(AbstractExtensionConnection.java:204)
at
org.openqa.selenium.firefox.internal.AbstractExtensionConnection.waitForResponseFor
(AbstractExtensionConnection.java:193)
at
org.openqa.selenium.firefox.internal.AbstractExtensionConnection.sendMessageAndWaitForResponse
(AbstractExtensionConnection.java:161)
at org.openqa.selenium.firefox.FirefoxDriver.sendMessage
(FirefoxDriver.java:258)
at org.openqa.selenium.firefox.FirefoxDriver.sendMessage
(FirefoxDriver.java:254)
at org.openqa.selenium.firefox.FirefoxDriver.getWindowHandles
(FirefoxDriver.java:278)
at
com.authoria.automation.base.AuthoriaWebDriverFacade.getWindowHandles
(AuthoriaWebDriverFacade.java:111)


I was wondering if you had any insight into this, and whether this was
a known issue or not. I'll be happy to provide you any information I
can assist with.

Thanks.

-Matthew

Matt

unread,
Jun 2, 2009, 10:28:54 AM6/2/09
to webdriver
Also, I did a try/catch for it, and then tried to see if I could do a
simple getWindowHandle() and I get the following exception:

09:24:06,046 DEBUG [TestUser] Looking for constraint name in Exception
message 'A JSONObject text must begin with '{' at character 0'
09:24:06,046 ERROR [] ***** Exception in runTest() for class
com.authoria.automation.user.TestUser:
org.openqa.selenium.WebDriverException: Could not parse "".

Caused by: org.openqa.selenium.WebDriverException: Could not parse "".
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1',
java.version: '1.6.0_13'
Driver info: driver.version: firefox
at org.openqa.selenium.firefox.Response.<init>(Response.java:51)
at
org.openqa.selenium.firefox.internal.AbstractExtensionConnection.nextResponse
(AbstractExtensionConnection.java:235)
at
org.openqa.selenium.firefox.internal.AbstractExtensionConnection.readLoop
(AbstractExtensionConnection.java:200)
at
org.openqa.selenium.firefox.internal.AbstractExtensionConnection.waitForResponseFor
(AbstractExtensionConnection.java:193)
at
org.openqa.selenium.firefox.internal.AbstractExtensionConnection.sendMessageAndWaitForResponse
(AbstractExtensionConnection.java:161)
at org.openqa.selenium.firefox.FirefoxDriver.sendMessage
(FirefoxDriver.java:258)
at org.openqa.selenium.firefox.FirefoxDriver.sendMessage
(FirefoxDriver.java:254)
at org.openqa.selenium.firefox.FirefoxDriver.getWindowHandle
(FirefoxDriver.java:274)
at
com.authoria.automation.base.AuthoriaWebDriverFacade.getWindowHandle
(AuthoriaWebDriverFacade.java:105)

Matt

unread,
Jun 2, 2009, 4:12:12 PM6/2/09
to webdriver
Some more info:

More investigation seems to lead to this is happening after a JS
window.close() is called. If the window is manually closed via user
intervention it can interact just fine. One interesting thing is, I
bypassed the buttons onclick() when it would call a window.close(),
and just did a WebDriver.close(), but even doing the webdriver close()
method, the getWindowHandles would still throw an error.

Hope that helps.

Simon Stewart

unread,
Jun 3, 2009, 5:59:35 AM6/3/09
to webd...@googlegroups.com
Hi,

This sounds like a bug in the underlying webdriver. Could you please
file an issue so that I've got a fighting chance to remember it.

I think that this behaviour is already tickled by one of the Selenium
RC emulation tests. If anyone's interested in looking into this, I'd
be happy to offer advice.

Regards,

Simon

Matt

unread,
Jun 3, 2009, 2:51:06 PM6/3/09
to webdriver
Thanks for the reply. Here is the issue:

http://code.google.com/p/webdriver/issues/detail?id=195&sort=-id

On Jun 3, 4:59 am, Simon Stewart <simon.m.stew...@gmail.com> wrote:
> Hi,
>
> This sounds like a bug in the underlying webdriver. Could you please
> file an issue so that I've got a fighting chance to remember it.
>
> I think that this behaviour is already tickled by one of the Selenium
> RC emulation tests. If anyone's interested in looking into this, I'd
> be happy to offer advice.
>
> Regards,
>
> Simon
>

Simon Stewart

unread,
Jun 8, 2009, 5:18:49 AM6/8/09
to webd...@googlegroups.com
Lovely. Thank you.

Simon
Reply all
Reply to author
Forward
0 new messages