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

Function context_factory

tests/async/conftest.py:93–105  ·  view source on GitHub ↗
(
    browser: Browser,
)

Source from the content-addressed store, hash-verified

91
92@pytest.fixture
93async def context_factory(
94 browser: Browser,
95) -> AsyncGenerator["Callable[..., Awaitable[BrowserContext]]", None]:
96 contexts = []
97
98 async def launch(**kwargs: Any) -> BrowserContext:
99 context = await browser.new_context(**kwargs)
100 contexts.append(context)
101 return context
102
103 yield launch
104 for context in contexts:
105 await context.close()
106
107
108@pytest.fixture(scope="session")

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected