new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Playwright · API reference · all subjects

screencast/methods

23 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Screencast.start method signature and return type

Screencast.start is an async method that returns a Disposable. It was introduced in v1.59.

Screencast.start basic usage

Screencast.start starts the screencast. When path option is provided, it saves video recording to the specified file. When onFrame option is provided, it delivers JPEG-encoded frames to the callback. Both can be used together.

Screencast.start onFrame parameter

The onFrame parameter is a callback function that receives ScreencastFrame objects. The callback takes an object with the following properties: data (Buffer) containing JPEG-encoded frame data, timestamp (float) in milliseconds since Unix epoch, viewportWidth (int) of the page viewport, and viewportHeight (int) of the page viewport.

Screencast.start path parameter

The path parameter is a file path where the video should be saved when the screencast is stopped. When provided, video recording is started.

Screencast.start quality parameter

The quality parameter is an integer between 0-100 that specifies the quality of the captured image.

Screencast.start size parameter

The size parameter is an optional object with width (int) and height (int) properties in pixels, specifying the max frame dimensions. The actual frame is scaled to preserve the page's aspect ratio and may be smaller than these bounds. If a screencast is already active, the existing configuration takes precedence. If not specified, the size defaults to the page viewport scaled down to fit into 800×800.

Screencast.start code example with video recording

await page.screencast.start({ path: 'video.webm', size: { width: 1280, height: 800 } }); // ... perform actions ... await page.screencast.stop();

Screencast.start code example with frame capture

await page.screencast.start({ onFrame: ({ data, timestamp, viewportWidth, viewportHeight }) => { console.log(`frame size: ${data.length} (${viewportWidth}x${viewportHeight}) at ${timestamp}`); }, size: { width: 800, height: 600 }, }); // ... perform actions ... await page.screencast.stop();

Screencast.stop method signature

Screencast.stop is an async method introduced in v1.59. It stops the screencast and video recording if active. If a video was being recorded, it saves it to the path specified in the start method.

Screencast.showOverlay method signature and return type

Screencast.showOverlay is an async method introduced in v1.59 that returns a Disposable. It adds an overlay with the given HTML content displayed on top of the page until removed.

Screencast.showOverlay html parameter

The html parameter is a required string containing HTML content for the overlay.

Screencast.showChapter method signature

Screencast.showChapter is an async method introduced in v1.59. It shows a chapter overlay with a title and optional description, centered on the page with a blurred backdrop. The overlay is removed after the specified duration, or 2000ms by default.

Screencast.showChapter title parameter

The title parameter is a required string containing the title text displayed prominently in the overlay.

Screencast.showChapter description parameter

The description parameter is an optional string containing description text displayed below the title.

Screencast.showChapter duration parameter

The duration parameter is an optional float in milliseconds after which the overlay is automatically removed. It defaults to 2000.

Screencast.showActions method signature and return type

Screencast.showActions is an async method introduced in v1.59 that returns a Disposable. It enables visual annotations on interacted elements and returns a disposable that stops showing actions when disposed.

Screencast.showActions duration parameter

The duration parameter is an optional float in milliseconds specifying how long each annotation is displayed. It defaults to 500.

Screencast.showActions position parameter

The position parameter is an optional AnnotatePosition that can be one of: "top-left", "top", "top-right", "bottom-left", "bottom", or "bottom-right". It specifies the position of the action title overlay and defaults to "top-right".

Screencast.showActions fontSize parameter

The fontSize parameter is an optional integer specifying the font size of the action title in pixels. It defaults to 24.

Screencast.showActions cursor parameter

The cursor parameter is an optional ScreencastCursor that can be one of: "none" or "pointer". The "pointer" option (the default) renders a mouse pointer that animates from the previous action point to the next one. The "none" option disables the cursor decoration. This parameter was introduced in v1.61.

Screencast.showOverlays method signature

Screencast.showOverlays is an async method introduced in v1.59 that shows overlays.

Screencast.hideActions method signature

Screencast.hideActions is an async method introduced in v1.59 that removes action decorations.

Screencast.hideOverlays method signature

Screencast.hideOverlays is an async method introduced in v1.59 that hides overlays without removing them.

Give your agent this brain