Session [xxx-xxx-xxx-xxx] has no driver. The browser window may have been closed

267 views
Skip to first unread message

Chester Tester

unread,
Apr 22, 2013, 2:56:43 PM4/22/13
to cu...@googlegroups.com
I have multiple features when run together throw this error.  If I run the scenarios by them self there is no issue.  I think the issue is that popups are generated during the test run and are not closed properly.  I have code in an After hook that closes all open windows except the very first window opened.

Error: **Session [2c50a228-3ad7-a544-a6ca-5d173b86bc86] has no driver. The browser window may have been closed. (Selenium::WebDriver::Error::UnknownError)**

I have added a bunch of print statements in my code to get the current state:
<br>
After:Session  -> #<>Capybara::Session:0x00000100f811b8><br>
Before:Driver -> selenium<br>
Before:Session Object -#<>Capybara::Session:0x00000100f811b8><br>
Before: (start) Driver Object #<>Capybara::Selenium::Driver:0x000001028ad790>

The scenario before this particular scenario fails, this HAS to be the culprit, but why?  Can anyone point me in the right direction?
<br>
<br>
**After hook**<br>
<code>

    #assume ONLY last window opened is to be closed
    page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
    page.execute_script "window.close();"
     
    #switch back to first window opened, make it the default window now
    page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)

</code>
<br>
***Env:
capybara (2.0.3)<br>
cucumber (1.1.9)<br>
selenium-webdriver (2.29.0)<br>
ruby 1.9.3p0***

aslak hellesoy

unread,
Apr 22, 2013, 3:06:40 PM4/22/13
to Cucumber Users
On Mon, Apr 22, 2013 at 7:56 PM, Chester Tester <marctho...@gmail.com> wrote:
I have multiple features when run together throw this error.  If I run the scenarios by them self there is no issue.  I think the issue is that popups are generated during the test run and are not closed properly.  I have code in an After hook that closes all open windows except the very first window opened.

Error: **Session [2c50a228-3ad7-a544-a6ca-5d173b86bc86] has no driver. The browser window may have been closed. (Selenium::WebDriver::Error::UnknownError)**


Wrong list. Please ask on the Selenium list.

Aslak
 
I have added a bunch of print statements in my code to get the current state:
<br>
After:Session  -> #<>Capybara::Session:0x00000100f811b8><br>
Before:Driver -> selenium<br>
Before:Session Object -#<>Capybara::Session:0x00000100f811b8><br>
Before: (start) Driver Object #<>Capybara::Selenium::Driver:0x000001028ad790>

The scenario before this particular scenario fails, this HAS to be the culprit, but why?  Can anyone point me in the right direction?
<br>
<br>
**After hook**<br>
<code>

    #assume ONLY last window opened is to be closed
    page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)
    page.execute_script "window.close();"
     
    #switch back to first window opened, make it the default window now
    page.driver.browser.switch_to.window(page.driver.browser.window_handles.first)

</code>
<br>
***Env:
capybara (2.0.3)<br>
cucumber (1.1.9)<br>
selenium-webdriver (2.29.0)<br>
ruby 1.9.3p0***

--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages