Best Python code snippet using playwright-python
test_browsercontext_add_cookies.py
Source:test_browsercontext_add_cookies.py
...220 await page.goto(server.EMPTY_PAGE)221 assert await page.evaluate("document.cookie") == ""222 await page.goto(server.PREFIX + "/grid.html")223 assert await page.evaluate("document.cookie") == "gridcookie=GRID"224async def test_should_not_set_a_cookie_with_blank_page_url(context, server):225 with pytest.raises(Error) as exc_info:226 await context.add_cookies(227 [228 {"url": server.EMPTY_PAGE, "name": "example-cookie", "value": "best"},229 {"url": "about:blank", "name": "example-cookie-blank", "value": "best"},230 ]231 )232 assert (233 'Blank page can not have cookie "example-cookie-blank"'234 in exc_info.value.message235 )236async def test_should_not_set_a_cookie_on_a_data_url_page(context):237 with pytest.raises(Error) as exc_info:238 await context.add_cookies(...
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!!