1234# Agent writes React component, then verifies playwriter -s 1 -e 'await page.goto("http://localhost:3000/new-feature")' playwriter -s 1 -e 'console.log(await snapshot({ page }))' # Agent sees broken layout, fixes the code, checks again
createDebugger, inspect CSS with getStylesForLocator, live-edit source with createEditor, and intercept network requests. All from the same session.1234567# Test authenticated flows without login setup playwriter -s 1 -e 'await page.goto("https://myapp.com/dashboard")' playwriter -s 1 -e 'console.log(await snapshot({ page, search: /error|warning/i }))' # Verify forms, buttons, navigation playwriter -s 1 -e 'await page.locator("button:has-text(\"Save\")").click()' playwriter -s 1 -e 'console.log(await snapshot({ page, search: /success|saved/i }))'
1234567playwriter -s 1 -e $' state.page = context.pages().find(p => p.url() === "about:blank") ?? await context.newPage() await state.page.goto("https://www.youtube.com/playlist?list=PLxxxxxx") await waitForPageLoad({ page: state.page, timeout: 5000 }) const videos = await state.page.$$eval("a#video-title", els => els.map(e => ({ title: e.textContent.trim(), href: e.href }))) console.log(JSON.stringify(videos, null, 2)) '
12# Read CSV data and fill a form for each row playwriter -s 1 -f fill-forms.js
12345678910playwriter -s 1 -e $' state.page = context.pages().find(p => p.url() === "about:blank") ?? await context.newPage() await state.page.goto("https://analytics.example.com/export") const [download] = await Promise.all([ state.page.waitForEvent("download"), state.page.click("button:has-text(\"Export CSV\")") ]) await download.saveAs("/tmp/analytics.csv") console.log("Saved to /tmp/analytics.csv") '
1234567891011121314151617# Start intercepting API calls playwriter -s 1 -e $' state.page = context.pages().find(p => p.url() === "about:blank") ?? await context.newPage() state.responses = [] state.page.on("response", async res => { if (res.url().includes("/api/")) { try { state.responses.push({ url: res.url(), status: res.status(), body: await res.json() }) } catch {} } }) ' # Navigate and interact — API calls are captured playwriter -s 1 -e 'await state.page.click("button.load-more")' # Inspect captured API schemas playwriter -s 1 -e 'state.responses.forEach(r => console.log(r.status, r.url.slice(0, 100)))' playwriter -s 1 -e 'console.log(JSON.stringify(state.responses[0].body, null, 2).slice(0, 2000))'
12345678# User runs on their machine npx -y traforo -p 19988 -- npx -y playwriter serve --token SHARED_SECRET # You connect from anywhere export PLAYWRITER_HOST=https://user-machine-tunnel.traforo.dev export PLAYWRITER_TOKEN=SHARED_SECRET playwriter session new playwriter -s 1 -e 'console.log(await snapshot({ page }))'
chrome.tabCapture and survives page navigation.123456789# Start recording playwriter -s 1 -e 'await recording.start({ page, outputPath: "/tmp/demo.mp4" })' # Do things — recording continues through navigation playwriter -s 1 -e 'await page.goto("https://example.com")' playwriter -s 1 -e 'await page.click("a")' # Stop and save playwriter -s 1 -e 'await recording.stop({ page })'
createDemoVideo to produce polished demos.curl and fetch. Playwriter renders them in a real browser with your logged-in session.1234567playwriter -s 1 -e $' state.page = context.pages().find(p => p.url() === "about:blank") ?? await context.newPage() await state.page.goto("https://www.instagram.com/p/ABC123/", { waitUntil: "domcontentloaded" }) await waitForPageLoad({ page: state.page, timeout: 8000 }) const content = await getPageMarkdown({ page: state.page, showDiffSinceLastCall: false }) console.log(content) '