MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / ensure_valid_window

Function ensure_valid_window

py/conftest.py:544–555  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

542 else:
543
544 def ensure_valid_window():
545 try:
546 driver = selenium_driver._driver
547 if driver:
548 try:
549 # Check if current window is still valid
550 driver.current_window_handle
551 except Exception:
552 # restart driver
553 selenium_driver.stop_driver()
554 except Exception:
555 pass
556
557 request.addfinalizer(ensure_valid_window) # noqa: PT021
558

Callers

nothing calls this directly

Calls 1

stop_driverMethod · 0.80

Tested by

no test coverage detected