Skip to content

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

Closed
geron opened this Issue Feb 14, 2013 · 4 comments

4 participants

@geron
geron commented Feb 14, 2013

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

Error: cannot access member `resetOneShotCallbacks' of deleted QObject

  session.js:254

I can provide a sample script if you need.

@detro
Owner
detro commented Feb 15, 2013

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

@djgoku
djgoku commented Feb 15, 2013

I was able to reproduce this with phantomjs 1.8.1:

window_close.html:

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

Error: cannot access member `resetOneShotCallbacks' of deleted QObject

:/ghostdriver/session.js:218

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 org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement@b8248a13] at URL: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33
/element/0/click)                                                                                                                                                                    
09:48:32.139 INFO - Done: /session/3c1bc3fd-cbd3-494f-8ea5-fbb475890b33/element/0/click       
@detro detro was assigned Mar 16, 2013
@merrill77

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
Owner
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.
6cacde9
@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.