Playwright page.screencast records videos, streams frames and manages annotations
Introduced 2026-04-01 · score 0.93
HOW TO USE IT
When preparing browser workflow evidence, record activity or capture JPEG frames with `page.screencast.start()` and finish with `page.screencast.stop()`; add action annotations or overlays as needed. In Playwright Test fixtures, configure annotations under the `video` option.
await page.screencast.start({ path: 'video.webm', size: { width: 1280, height: 800 } });
// ... perform actions ...
await page.screencast.stop();await page.screencast.start({
onFrame: ({ data, timestamp, viewportWidth, viewportHeight }) => {
processFrame(data, timestamp, viewportWidth, viewportHeight);
},
size: { width: 800, height: 600 },
});
// ... perform actions ...
await page.screencast.stop();await page.screencast.start({ path: 'video.webm' });
await page.screencast.showActions({ position: 'top-right' });
await page.screencast.showChapter('Verification', { description: 'Browser workflow evidence' });
// ... perform actions ...
await page.screencast.stop();WHY THIS HELPS
When verifying a repository's browser workflow and preparing evidence for review, record the page activity with annotations or capture frames for processing.
BEFORE THIS CHANGE
The v1.59 release note describes `page.screencast.start()` and `stop()` as an alternative to the `recordVideo` browser-context option.
REQUIREMENTS AND LIMITATIONS
- Version: v1.59.0
- start({ path }): `path` is optional; when supplied, starts recording to that file. `size` optionally sets maximum frame width and height; `onFrame` optionally receives JPEG frame data and viewport dimensions.
- showActions({ position, duration, fontSize }): All options are optional. `position` selects the title overlay position; `duration` sets annotation display time in milliseconds (default 500); `fontSize` sets title size in pixels (default 24). Returns a disposable that stops annotations when disposed.
- showChapter(title, { description, duration }) (required): `title` is required. `description` and `duration` are optional; duration is milliseconds and defaults to 2000.
- showOverlay(html, { duration }) (required): `html` is required. Optional `duration` is milliseconds; without it, the overlay stays until dismissed or disposed.
- video.show.actions.position: In the Playwright Test `video` option, `show.actions.position` selects the annotation title position; `show.test.position` selects the test annotation position.
- Prerequisite: The screencast methods are documented as added in Playwright v1.59.
- Prerequisite: For Playwright Test fixture video annotations, configure the `video` option under `use`; the release-note example sets `mode: 'on'`.
- `showActions()` accepts `position` values `'top-left'`, `'top'`, `'top-right'`, `'bottom-left'`, `'bottom'`, and `'bottom-right'`, `duration` in milliseconds per annotation, and `fontSize` in pixels; it returns a disposable to stop showing actions.
- Docs conflict: The current API docs include later additions: `cursor` since v1.61 and `style` since v1.64; they also mark `fontSize` deprecated. Those later changes do not establish v1.59 behavior.
FIRST-PARTY EVIDENCE
- https://github.com/microsoft/playwright/releases/tag/v1.59.0
- https://playwright.dev/docs/api/class-screencast
Check the installed version and the source before using it. Entry JSON