{"record":{"id":"ce10ba05b0348f06","repo":"teamcapybara/capybara","slug":"timed-out-waiting-for-selenium-session-reset","errorCode":null,"errorMessage":"Timed out waiting for Selenium session reset","messagePattern":"Timed out waiting for Selenium session reset","errorType":"exception","errorClass":"Capybara::ExpectationNotMet","httpStatus":null,"severity":"error","filePath":"lib/capybara/selenium/driver.rb","lineNumber":482,"sourceCode":"\n  def setup_exit_handler\n    main = Process.pid\n    at_exit do\n      # Store the exit status of the test run since it goes away after calling the at_exit proc...\n      @exit_status = $ERROR_INFO.status if $ERROR_INFO.is_a?(SystemExit)\n      quit if Process.pid == main\n      exit @exit_status if @exit_status # Force exit with stored status\n    end\n  end\n\n  def reset_browser_state\n    clear_browser_state\n    @browser.navigate.to('about:blank')\n  end\n\n  def wait_for_empty_page(timer)\n    until find_xpath('/html/body/*').empty?\n      raise Capybara::ExpectationNotMet, 'Timed out waiting for Selenium session reset' if timer.expired?\n\n      sleep 0.01\n\n      # It has been observed that it is possible that asynchronous JS code in\n      # the application under test can navigate the browser away from about:blank\n      # if the timing is just right. Ensure we are still at about:blank...\n      @browser.navigate.to('about:blank') unless current_url == 'about:blank'\n    end\n  end\n\n  def accept_unhandled_reset_alert\n    @browser.switch_to.alert.accept\n    sleep 0.25 # allow time for the modal to be handled\n  rescue modal_error\n    # The alert is now gone.\n    # If navigation has not occurred attempt again and accept alert\n    # since FF may have dismissed the alert at first attempt.\n    navigate_with_accept('about:blank') if current_url != 'about:blank'","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/teamcapybara/capybara/blob/15b5fdb76e972e9623d5af2123ed3755594f9732/lib/capybara/selenium/driver.rb#L464-L500","documentation":"Error \"Timed out waiting for Selenium session reset\" thrown in teamcapybara/capybara.","triggerScenarios":"Thrown at lib/capybara/selenium/driver.rb:482 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"15b5fdb76e972e9623d5af2123ed3755594f9732","analyzedAt":"2026-08-21T16:53:45.588Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}