diff --git a/docs/api/puppeteer.screenshotoptions.md b/docs/api/puppeteer.screenshotoptions.md index 784e37b6..47470e84 100644 --- a/docs/api/puppeteer.screenshotoptions.md +++ b/docs/api/puppeteer.screenshotoptions.md @@ -20,6 +20,7 @@ export interface ScreenshotOptions | fromSurface | optional | boolean | Capture the screenshot from the surface, rather than the view. | true | | fullPage | optional | boolean | When true, takes a screenshot of the full page. | false | | omitBackground | optional | boolean | Hides default white background and allows capturing screenshots with transparency. | false | +| optimizeForSpeed | optional | boolean | | false | | path | optional | string | The file path to save the image to. The screenshot type will be inferred from file extension. If path is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk. | | | quality | optional | number | Quality of the image, between 0-100. Not applicable to png images. | | | type | optional | 'png' \| 'jpeg' \| 'webp' | | png | diff --git a/packages/puppeteer-core/src/api/Page.ts b/packages/puppeteer-core/src/api/Page.ts index 60e2f043..c70ae773 100644 --- a/packages/puppeteer-core/src/api/Page.ts +++ b/packages/puppeteer-core/src/api/Page.ts @@ -170,6 +170,10 @@ export interface ScreenshotClip { * @public */ export interface ScreenshotOptions { + /** + * @defaultValue `false` + */ + optimizeForSpeed?: boolean; /** * @defaultValue `png` */ diff --git a/packages/puppeteer-core/src/common/Page.ts b/packages/puppeteer-core/src/common/Page.ts index 99eecb8f..2c7b45f1 100644 --- a/packages/puppeteer-core/src/common/Page.ts +++ b/packages/puppeteer-core/src/common/Page.ts @@ -1267,6 +1267,7 @@ export class CDPPage extends Page { const result = await this.#client.send('Page.captureScreenshot', { format, + optimizeForSpeed: options.optimizeForSpeed, quality: options.quality, clip: clip && { ...clip,