MCPcopy Index your code
hub / github.com/microsoft/playwright-python / waiting_helper

Function waiting_helper

tests/async/test_element_handle.py:447–463  ·  view source on GitHub ↗
(page: Page, after: str)

Source from the content-addressed store, hash-verified

445
446
447async def waiting_helper(page: Page, after: str) -> None:
448 div = await page.query_selector("div")
449 assert div
450 done = []
451
452 async def scroll() -> None:
453 done.append(False)
454 await div.scroll_into_view_if_needed()
455 done.append(True)
456
457 promise = asyncio.create_task(scroll())
458 await asyncio.sleep(0) # execute scheduled tasks, but don't await them
459 await page.evaluate("() => new Promise(f => setTimeout(f, 1000))")
460 assert done == [False]
461 await div.evaluate(after)
462 await promise
463 assert done == [False, True]
464
465
466async def test_should_wait_for_display_none_to_become_visible(page: Page) -> None:

Calls 3

scrollFunction · 0.85
query_selectorMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected