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

Function ensure_valid_window

py/conftest.py:592–603  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

590 else:
591
592 def ensure_valid_window():
593 try:
594 driver = selenium_driver._driver
595 if driver:
596 try:
597 # Check if current window is still valid
598 driver.current_window_handle
599 except Exception:
600 # restart driver
601 selenium_driver.stop_driver()
602 except Exception:
603 pass
604
605 request.addfinalizer(ensure_valid_window) # noqa: PT021
606

Callers

nothing calls this directly

Calls 1

stop_driverMethod · 0.80

Tested by

no test coverage detected