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

Function main

tests/common/test_signals.py:43–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 signal.signal(signal.SIGINT, my_sig_handler)
42
43 async def main() -> None:
44 playwright = await async_playwright().start()
45 browser = await playwright[browser_name].launch(
46 **launch_arguments,
47 handle_sigint=False,
48 )
49 context = await browser.new_context()
50 page = await context.new_page()
51 notified = False
52 try:
53 while not sigint_received:
54 if not notified:
55 wait_queue.put("ready")
56 notified = True
57 await page.wait_for_timeout(100)
58 finally:
59 wait_queue.put("close context")
60 await context.close()
61 wait_queue.put("close browser")
62 await browser.close()
63 wait_queue.put("close playwright")
64 await playwright.stop()
65 wait_queue.put("all done")
66
67 asyncio.run(main())
68

Callers 1

_test_signals_asyncFunction · 0.70

Calls 9

async_playwrightFunction · 0.90
startMethod · 0.45
launchMethod · 0.45
new_contextMethod · 0.45
new_pageMethod · 0.45
putMethod · 0.45
wait_for_timeoutMethod · 0.45
closeMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected