Skip to content

Session reset times out if alert already present when trying to close the page #1696

@jnicklas

Description

@jnicklas

#1672 introduced behaviour which tries to make sure that resetting the session is going to close any alerts from a beforeunload handler. Unfortunately, if such an alert is already open, there's a race condition where Capybara never navigates to about:blank and thus gets stuck in a loop trying to check for no content, which never happens. This causes the session reset to time out with an error like:

/Users/jonasnicklas/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/capybara-2.7.0/lib/capybara/selenium/driver.rb:114:in `reset!': Timed out waiting for Selenium session reset (Capybara::ExpectationNotMet)
    from /Users/jonasnicklas/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/capybara-2.7.0/lib/capybara/session.rb:109:in `reset!'
    from test.rb:10:in `<main>'

I have a repro here. I'll try to submit a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions