MCPcopy
hub / github.com/reflex-dev/reflex / poll_for_navigation

Function poll_for_navigation

tests/integration/utils.py:45–64  ·  view source on GitHub ↗

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
)

Source from the content-addressed store, hash-verified

43
44@contextmanager
45def 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
67def n_expected_events(exp_event_order: Sequence[str | set[str]]) -> int:

Callers 5

test_on_load_navigateFunction · 0.85
test_render_dynamic_argFunction · 0.85
test_navigation_appFunction · 0.85

Calls 1

expectMethod · 0.80

Tested by 5

test_on_load_navigateFunction · 0.68
test_render_dynamic_argFunction · 0.68
test_navigation_appFunction · 0.68