Grab the existing context/page: context = browser.contexts[0]; page = context.pages[0]
Drive the page (page.goto, page.click, page.screenshot); then page.close(); browser.close(); playwright.stop()
Recording is available at https://browserbase.com/sessions/<session.id>
Docs: https://docs.browserbase.com/welcome/quickstarts/playwright and https://docs.browserbase.com/reference/sdk/python
Known gotchas
Use browser.contexts()[0] and context.pages()[0] — the session already has a default context opened; creating a new one detaches from the session's browser.
BROWSERBASE_API_KEY is a project-scoped key; the project is inferred from the key, so don't hand-pass projectId unless you need a specific one.
Use playwright-core in Node/Bun; Bun does not currently support Playwright.
Calling page.screenshot({fullPage:true}) before page.close() captures the full page.
Give your agent this knowledge — and 16,500+ more routes
One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?