Skip to content

Click on a link with href="javascript:window.close()" hangs #180

geron opened this Issue Feb 14, 2013 · 4 comments

4 participants

geron commented Feb 14, 2013

When clicking on such a link, I get this error:

Error: cannot access member `resetOneShotCallbacks' of deleted QObject


I can provide a sample script if you need.

detro commented Feb 15, 2013

I definitely need the sample and I'll be happy to look into this.

djgoku commented Feb 15, 2013

I was able to reproduce this with phantomjs 1.8.1:


<a id="click" href="javascript:window.close()">click me</a>

Error: cannot access member `resetOneShotCallbacks' of deleted QObject


Starting Selenium Standalone 2.29.0 with Firefox (it at least clicks the link):

09:48:04.226 INFO - Executing: [new session: {platform=ANY, acceptSslCerts=true, javascriptEnabled=true, browserName=firefox, proxy=null, version=}] at URL: /session)               
09:48:17.294 INFO - Done: /session                                                                                                                                                   
09:48:17.302 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@8f27fc at URL: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33)                        
09:48:17.302 INFO - Done: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33                                                                                                               
09:48:29.011 INFO - Executing: [get: http://localhost:3000/window_close.html] at URL: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33/url)                                              
09:48:29.788 INFO - Done: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33/url                                                                                                          
09:48:31.957 INFO - Executing: [find element: By.xpath: //*[@id='test']] at URL: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33/element)                                              
09:48:32.064 INFO - Done: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33/element                                                                                                       
09:48:32.070 INFO - Executing: [click: 0$EventFiringWebElement@b8248a13] at URL: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33
09:48:32.139 INFO - Done: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33/element/0/click       
@detro detro was assigned Mar 16, 2013

I've also encountered this with phantomjs 1.9.0. As a first pass in addressing this, it would be great if ghostdriver would throw an exception back to WebDriver, rather than hanging. That would at least allow us to push a relevant error message back to the user, rather than hanging. Thanks!

detro commented Jun 11, 2013

I think I have solved this.

Validating against the other implementations right now.

@detro detro added a commit that closed this issue Jun 11, 2013
@detro Handle "thisWindow.close()" cases.
It's possible that some windows contain javascript
code to close the very window we are pointing at.
This was causing GhostDriver to hang, as it was
assuming "THE" page to which that window was associated
would be always available.

The fix is pretty easy: we just ignore the fact
that the window is now gone and continue happily.

Fixes #180.
@detro detro closed this in 6cacde9 Jun 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.