Overview
Playwriter provides built-in screen recording using Chrome’schrome.tabCapture API. Unlike traditional screen recording, this approach:
- 100x more efficient than desktop screen capture (CPU usage: ~2% vs ~200%)
- Survives page navigation - recording continues across page reloads and navigation
- Native frame rate - captures at 30-60 FPS
- Includes ghost cursor - automatically overlays smooth cursor animations during interactions
Quick Start
API Reference
recording.start()
Starts recording the page as mp4 video. Parameters:page- Page to recordoutputPath- Path to save the video file (required)frameRate- Frame rate in FPS (default: 30)videoBitsPerSecond- Video bitrate in bps (default: 2500000 = 2.5 Mbps)audioBitsPerSecond- Audio bitrate in bps (default: 128000 = 128 kbps)audio- Include tab audio (default: false)
{ isRecording: boolean, startedAt: number, tabId: number }
recording.stop()
Stops recording and saves the video file. Parameters:page- Page being recorded
{ path: string, duration: number, size: number, executionTimestamps: Array }
recording.isRecording()
Checks if recording is currently active. Parameters:page- Page to check
{ isRecording: boolean, startedAt?: number, tabId?: number }
recording.cancel()
Cancels recording without saving the file. Parameters:page- Page being recorded
Ghost Cursor
While recording is active, Playwriter automatically overlays a smooth ghost cursor that follows automated mouse actions:page.mouse.move(),page.mouse.click()locator.click(),page.click()- Hover interactions
goto(itemUrl) instead of clicking the link) when your goal is to show realistic pointer motion in the recording.
Manual Ghost Cursor Control
You can show/hide the ghost cursor manually even when not recording:Creating Demo Videos
UsecreateDemoVideo() to automatically speed up idle sections (time between execute() calls) while keeping interactions at normal speed:
- Requires
ffmpegandffprobeinstalled on the system - Use
--timeout 120000(or higher) when calling createDemoVideo - ffmpeg processing can take 60-120+ seconds - A 1-second buffer is preserved around each interaction for context
Permission Requirements
Important: Recording requires the user to have clicked the Playwriter extension icon on the tab. This grantsactiveTab permission needed for chrome.tabCapture.
If you need to record a new tab, ask the user to click the extension icon on it first.
For automated recording without manual clicks, Chrome can be restarted with special flags:
How It Works
Extension-Based Recording
Recording useschrome.tabCapture which runs in the extension context, not the page. The extension holds the MediaRecorder, so:
- Recording persists across page navigations
- Page reloads don’t interrupt capture
- The recording survives even if the page crashes
getDisplayMedia() where the page context holds the recorder.
Efficiency Comparison
Desktop screen capture:- CPU: ~200% (encoding entire screen)
- FPS: Limited to 15-30
- File size: Large (captures everything)
- CPU: ~2% (encodes only tab content)
- FPS: Native 30-60
- File size: Optimized (captures only active tab)
Backward Compatibility
These functions remain available as aliases:recording.* namespace for consistency.