I’m confused about how browser contexts are used. In the tutorial I was able to merely do this:
def test_get_started_link(page: Page):
page.goto("https://playwright.dev/")
# Click the get started link.
page.get_by_role("link", name="Get started").click()
# Expects page to have a heading with the name of Installation.
expect(page.get_by_role("heading", name="Installation")).to_be_visible()
In the docs though it says I need to use a browser context to trace:
browser = chromium.launch()
context = browser.new_context()
context.tracing.start(screenshots=True, snapshots=True)
page = context.new_page()
page.goto("https://playwright.dev")
context.tracing.stop(path = "trace.zip")
How did my first snippet work? It says it uses chromium by default, is it just creating a new chromium.launch().new_context()
for me?
Do I have to explicitly create a context for tracing or can I use the one that is created by default (assuming that’s even what is happening).