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

Function test_should_use_proxy

tests/async/test_proxy.py:33–46  ·  view source on GitHub ↗
(
    browser_factory: "Callable[..., asyncio.Future[Browser]]", server: Server
)

Source from the content-addressed store, hash-verified

31
32
33async def test_should_use_proxy(
34 browser_factory: "Callable[..., asyncio.Future[Browser]]", server: Server
35) -> None:
36 server.set_route(
37 "/target.html",
38 lambda r: (
39 r.write(b"<html><title>Served by the proxy</title></html>"),
40 r.finish(),
41 ),
42 )
43 browser = await browser_factory(proxy={"server": f"localhost:{server.PORT}"})
44 page = await browser.new_page()
45 await page.goto("http://non-existent.com/target.html")
46 assert await page.title() == "Served by the proxy"
47
48
49async def test_proxy_should_allow_none_for_optional_settings(

Callers

nothing calls this directly

Calls 5

browser_factoryFunction · 0.85
set_routeMethod · 0.80
new_pageMethod · 0.45
gotoMethod · 0.45
titleMethod · 0.45

Tested by

no test coverage detected