mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
d57b1044f2
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
59 lines
1.4 KiB
Markdown
59 lines
1.4 KiB
Markdown
---
|
|
sidebar_label: Page.screencast
|
|
---
|
|
|
|
# Page.screencast() method
|
|
|
|
Captures a screencast of this [page](./puppeteer.page.md).
|
|
|
|
#### Signature:
|
|
|
|
```typescript
|
|
class Page {
|
|
screencast(options?: Readonly<ScreencastOptions>): Promise<ScreenRecorder>;
|
|
}
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Type | Description |
|
|
| --------- | --------------------------------------------------------------------- | -------------------------------------------- |
|
|
| options | Readonly<[ScreencastOptions](./puppeteer.screencastoptions.md)> | _(Optional)_ Configures screencast behavior. |
|
|
|
|
**Returns:**
|
|
|
|
Promise<[ScreenRecorder](./puppeteer.screenrecorder.md)>
|
|
|
|
## Remarks
|
|
|
|
All recordings will be [WebM](https://www.webmproject.org/) format using the [VP9](https://www.webmproject.org/vp9/) video codec. The FPS is 30.
|
|
|
|
You must have [ffmpeg](https://ffmpeg.org/) installed on your system.
|
|
|
|
## Example
|
|
|
|
Recording a [page](./puppeteer.page.md):
|
|
|
|
```
|
|
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();
|
|
```
|