Best Python code snippet using playwright-python
test_navigation.py
Source:test_navigation.py
...299):300 await page.goto(server.PREFIX + "/serviceworkers/fetch/sw.html")301 await page.evaluate("window.activationPromise")302 await page.goto(server.PREFIX + "/serviceworkers/fetch/sw.html")303async def test_goto_should_send_referer(page, server):304 [request1, request2, _] = await asyncio.gather(305 server.wait_for_request("/grid.html"),306 server.wait_for_request("/digits/1.png"),307 page.goto(server.PREFIX + "/grid.html", referer="http://google.com/"),308 )309 assert request1.getHeader("referer") == "http://google.com/"310 # Make sure subresources do not inherit referer.311 assert request2.getHeader("referer") == server.PREFIX + "/grid.html"312 assert page.url == server.PREFIX + "/grid.html"313async def test_goto_should_reject_referer_option_when_set_extra_http_headers_provides_referer(314 page, server315):316 await page.set_extra_http_headers({"referer": "http://microsoft.com/"})317 with pytest.raises(Error) as exc_info:...
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!