puppeteer/website/versioned_docs/version-22.6.3/api/puppeteer.page.screencast.md
release-please[bot] a63b8305ac
chore: release main (#12190)
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2024-04-05 13:11:52 +00:00

1.3 KiB

sidebar_label
Page.screencast

Page.screencast() method

Captures a screencast of this page.

Signature:

class Page {
  screencast(options?: Readonly<ScreencastOptions>): Promise<ScreenRecorder>;
}

Parameters

Parameter

Type

Description

options

Readonly<ScreencastOptions>

(Optional) Configures screencast behavior.

**Returns:**

Promise<ScreenRecorder>

Remarks

All recordings will be WebM format using the VP9 video codec. The FPS is 30.

You must have ffmpeg installed on your system.

Example

Recording a page:

import puppeteer from 'puppeteer';

// Launch a browser
const browser = await puppeteer.launch();

// Create a new page
const page = await browser.newPage();

// Go to your site.
await page.goto("https://www.example.com");

// Start recording.
const recorder = await page.screencast({path: 'recording.webm'});

// Do something.

// Stop recording.
await recorder.stop();

browser.close();