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

Function test_locators_tap

tests/async/test_tap.py:197–222  ·  view source on GitHub ↗
(page: Page)

Source from the content-addressed store, hash-verified

195
196
197async def test_locators_tap(page: Page) -> None:
198 await page.set_content(
199 """
200 <div id="a" style="background: lightblue; width: 50px; height: 50px">a</div>
201 <div id="b" style="background: pink; width: 50px; height: 50px">b</div>
202 """
203 )
204 await page.locator("#a").tap()
205 element_handle = await track_events(await page.query_selector("#b"))
206 await page.locator("#b").tap()
207 assert await element_handle.json_value() == [
208 "pointerover",
209 "pointerenter",
210 "pointerdown",
211 "touchstart",
212 "pointerup",
213 "pointerout",
214 "pointerleave",
215 "touchend",
216 "mouseover",
217 "mouseenter",
218 "mousemove",
219 "mousedown",
220 "mouseup",
221 "click",
222 ]
223
224
225async def track_events(target: Optional[ElementHandle]) -> JSHandle:

Callers

nothing calls this directly

Calls 6

track_eventsFunction · 0.70
set_contentMethod · 0.45
tapMethod · 0.45
locatorMethod · 0.45
query_selectorMethod · 0.45
json_valueMethod · 0.45

Tested by

no test coverage detected