Wait for driver url to change. Use as a contextmanager, and apply the navigation event inside the context block, polling will occur after the context block exits. Args: driver: WebDriver instance. timeout: Time to wait for url to change. Yields: None
(
driver: WebDriver, timeout: int = 5
)
| 43 | |
| 44 | @contextmanager |
| 45 | def poll_for_navigation( |
| 46 | driver: WebDriver, timeout: int = 5 |
| 47 | ) -> Generator[None, None, None]: |
| 48 | """Wait for driver url to change. |
| 49 | |
| 50 | Use as a contextmanager, and apply the navigation event inside the context |
| 51 | block, polling will occur after the context block exits. |
| 52 | |
| 53 | Args: |
| 54 | driver: WebDriver instance. |
| 55 | timeout: Time to wait for url to change. |
| 56 | |
| 57 | Yields: |
| 58 | None |
| 59 | """ |
| 60 | prev_url = driver.current_url |
| 61 | |
| 62 | yield |
| 63 | |
| 64 | AppHarness.expect(lambda: prev_url != driver.current_url, timeout=timeout) |
| 65 | |
| 66 | |
| 67 | def n_expected_events(exp_event_order: Sequence[str | set[str]]) -> int: |