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

Function ensure_valid_window

py/conftest.py:590–601  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

stop_driverMethod · 0.80

Tested by

no test coverage detected