MCPcopy Create free account
hub / github.com/microsoft/playwright-python / test_should_emit_blur_event

Function test_should_emit_blur_event

tests/async/test_focus.py:36–49  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

34
35
36async def test_should_emit_blur_event(page: Page) -> None:
37 await page.set_content(
38 "<div id=d1 tabIndex=0>DIV1</div><div id=d2 tabIndex=0>DIV2</div>"
39 )
40 await page.focus("#d1")
41 focused = []
42 blurred = []
43 await page.expose_function("focusEvent", lambda: focused.append(True))
44 await page.expose_function("blurEvent", lambda: blurred.append(True))
45 await page.evaluate("() => d1.addEventListener('blur', blurEvent)")
46 await page.evaluate("() => d2.addEventListener('focus', focusEvent)")
47 await page.focus("#d2")
48 assert focused == [True]
49 assert blurred == [True]
50
51
52async def test_should_traverse_focus(page: Page) -> None:

Callers

nothing calls this directly

Calls 5

appendMethod · 0.80
set_contentMethod · 0.45
focusMethod · 0.45
expose_functionMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected