Skip to main content
Version: 22.14.0

Page.screenshot() method

Captures a screenshot of this page.

Signature:

class Page {
screenshot(
options: Readonly<ScreenshotOptions> & {
encoding: 'base64';
}
): Promise<string>;
}

Parameters

Parameter

Type

Description

options

Readonly<ScreenshotOptions> & { encoding: 'base64'; }

Configures screenshot behavior.

Returns:

Promise<string>

Remarks

While a screenshot is being taken in a BrowserContext, the following methods will automatically wait for the screenshot to finish to prevent interference with the screenshot process: BrowserContext.newPage(), Browser.newPage(), Page.close().

Calling Page.bringToFront() will not wait for existing screenshot operations.