Page.screenshot() method
screenshot(): Promise<string>
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.
screenshot(): Promise<Uint8Array>
Signature
class Page {
screenshot(options?: Readonly<ScreenshotOptions>): Promise<Uint8Array>;
}
Parameters
Parameter | Type | Description |
---|---|---|
options | Readonly<ScreenshotOptions> | (Optional) |
Returns:
Promise<Uint8Array>