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

Function test_events

tests/common/test_events.py:22–32  ·  view source on GitHub ↗
(browser_name: str, launch_arguments: Dict, server: Server)

Source from the content-addressed store, hash-verified

20
21
22def test_events(browser_name: str, launch_arguments: Dict, server: Server) -> None:
23 with pytest.raises(Exception, match="fail"):
24
25 def fail() -> None:
26 raise Exception("fail")
27
28 with sync_playwright() as p:
29 with p[browser_name].launch(**launch_arguments) as browser:
30 with browser.new_page() as page:
31 page.on("response", lambda _: fail())
32 page.goto(server.PREFIX + "/grid.html")

Callers

nothing calls this directly

Calls 6

sync_playwrightFunction · 0.90
failFunction · 0.85
launchMethod · 0.45
new_pageMethod · 0.45
onMethod · 0.45
gotoMethod · 0.45

Tested by

no test coverage detected