Recording a Product Demo Video with Playwright: 6 Things That Break A technical guide on Demo Tool AI details six failure modes that break Playwright-recorded product demo videos and the code fixes for each, including using the browser launch flag --force-device-scale-factor=2 with viewport set to null to record a 1280×800 page at 2560×1600 so a 2× zoom stays sharp in 1080p output. The guide notes that deviceScaleFactor: 2 does nothing because frames captured through the Chrome DevTools Protocol screencast return at CSS size, and it offers a MutationObserver-based waitUntilStill function that resolves once no element is added or removed for 250 ms, capped at 4000 ms, instead of fixed sleeps after client-side route changes. The author also recommends logging mouse moves with timestamps and drawing a cursor over the footage in the edit, since Playwright's default recording shows no cursor. Recording a Product Demo Video with Playwright: 6 Things That Break Playwright can record a video of a browser session in three lines. That makes automating a product demo video look like an afternoon's work. The recording part is. Making it look like something you would put on a landing page takes a lot longer. Demo Tool AI is a tool that makes narrated product dem o videos by driving a web app in a cloud browser. This post looks at the recording half of that job: six things that break, and the code that fixes each one. All of it applies if you write the Playwright script by hand and never touch an AI model. You can watch six demos recorded this way, of Notion, Plausible, EspoCRM, Grafana and the tool's own site, on its examples page. This is the version everyone writes first: import { chromium } from 'playwright'; const browser = await chromium.launch ; const context = await browser.newContext { viewport: { width: 1280, height: 800 }, recordVideo: { dir: 'videos', size: { width: 1280, height: 800 } }, } ; const page = await context.newPage ; await page.goto 'https://app.example.com' ; await page.getByRole 'button', { name: 'New project' } .click ; await page.getByLabel 'Project name' .fill 'Q3 launch' ; await context.close ; // the video is written when the context closes await browser.close ; It works, and the file it writes is a test artifact. As a demo it fails on four counts: there is no cursor, so nobody can see what was clicked; the text appears in the field in a single frame; nothing waits for the page, so half the clicks land on a loading screen; zoom in on anything and it turns to mush. There is also a fifth problem that code doesn't fix: a demo needs a story. Decide the one task you are showing and who it is for before you script anything. There is a separate guide to that part: how to make a product demo video. The cursor is the easy one. Log every mouse move with a timestamp while the script runs, then draw your own cursor over the footage in the edit. The other problems took more work. A demo zooms in on the thing being clicked, so the recording needs more pixels than the output. The obvious fix is deviceScaleFactor: 2 on the context. That does nothing when the frames are captured through the Chrome DevTools Protocol screencast: they come back at CSS size whatever the emulated scale is. What works is setting the scale on the browser window itself and leaving the viewport unemulated: const browser = await chromium.launch { args: '--force-device-scale-factor=2', '--window-size=1280,800' , } ; const context = await browser.newContext { viewport: null } ; A 1280×800 page is then recorded at 2560×1600, and a 2× zoom in a 1080p output is still sharp. After a click in a single-page app, the route changes on the client. There is no new document, so waitForLoadState 'load' has already passed, and networkidle often has too. The next action runs against the previous screen, or against a skeleton. Fixed sleeps are the usual patch, and they are wrong in both directions: too short on a slow day, dead air in the video on a fast one. A better approach is to wait until the page stops changing: import type { Page } from 'playwright'; / Resolves once no element was added or removed for quiet ms. / async function waitUntilStill page: Page, quiet = 250, max = 4000 { await page .evaluate quiet, max = new Promise