Use this file to discover all available pages before exploring further.
AI agent instructions
STOP. Do not read past this section until you have read and followed /quickstart.md.Goal: produce a reliable SDK automation script. The intended authoring flow is generate then edit, not write browser automation from scratch.Do not hand-write SDK code with element IDs, selectors, or form fields from memory. Element IDs, selectors, and field mappings must come from a live observe() call, CLI notte page observe output, or generated workflow code. Guessed browser targets fail on real pages.Use the Notte skill and CLI to inspect the live site, validate actions/selectors, handle auth/session state, and export workflow code with notte sessions workflow-code before using SDK docs or SDK code.SDK reference pages are for understanding, running, or editing generated workflow code. They are not the starting point for manually authoring the initial browser automation. SDK-first code is guesswork on real-world pages with dynamic selectors, auth state, CAPTCHAs, and anti-bot behavior.
Notte sessions expose a Chrome DevTools Protocol (CDP) endpoint that you can connect to with Playwright. This allows you to use Playwright’s API directly while still benefiting from Notte’s cloud infrastructure, anti-detection features, and session management.
Get the CDP URL from a Notte session and connect Playwright to it:
from notte_sdk import NotteClientfrom playwright.sync_api import sync_playwrightclient = NotteClient()# Start a Notte sessionwith client.Session() as session: # Get CDP WebSocket URL cdp_url = session.cdp_url() print(f"CDP URL: {cdp_url}") # Connect Playwright to the Notte session with sync_playwright() as p: browser = p.chromium.connect_over_cdp(cdp_url) # Access the page (Notte sessions have one context with one page) context = browser.contexts[0] page = context.pages[0] # Use Playwright API directly page.goto("https://example.com") print(f"Title: {page.title()}") # Take a screenshot page.screenshot(path="screenshot.png")
Notte sessions automatically create a browser context with one page. Access it via browser.contexts[0].pages[0].
You can use both the Notte session API and Playwright simultaneously:
from notte_sdk import NotteClientfrom playwright.sync_api import sync_playwrightclient = NotteClient()with client.Session() as session: # Use Notte's built-in page notte_page = session.page notte_page.goto("https://example.com") # Also connect Playwright for advanced features cdp_url = session.cdp_url() with sync_playwright() as p: browser = p.chromium.connect_over_cdp(cdp_url) playwright_page = browser.contexts[0].pages[0] # Use Playwright's advanced features playwright_page.route("**/*.{png,jpg,jpeg}", lambda route: route.abort()) # Navigate with route interception active playwright_page.goto("https://example.com/gallery") # Use Playwright's network monitoring with playwright_page.expect_response("**/api/data") as response_info: playwright_page.click("button#load-data") response = response_info.value print(f"API Response: {response.status()}")
Always use context managers for both Notte and Playwright to ensure proper cleanup:
playwright_context_managers.py
from notte_sdk import NotteClientfrom playwright.sync_api import sync_playwright # type: ignore[import-not-found]client = NotteClient()with client.Session() as session: with sync_playwright() as p: # Your code here pass
For simple automation, use session.page directly. Only connect Playwright when you need advanced features like network interception or custom contexts.