mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat: default screenshot jpeg quality to 80 (#22966)
Fixes https://github.com/microsoft/playwright/issues/22436
This commit is contained in:
parent
8a09d6dc0b
commit
d7f5f1f5fe
@ -440,6 +440,7 @@ export class FFPage implements PageDelegate {
|
||||
const { data } = await this._session.send('Page.screenshot', {
|
||||
mimeType: ('image/' + format) as ('image/png' | 'image/jpeg'),
|
||||
clip: documentRect,
|
||||
quality,
|
||||
omitDeviceScaleFactor: scale === 'css',
|
||||
});
|
||||
return Buffer.from(data, 'base64');
|
||||
|
||||
@ -288,7 +288,8 @@ export class Screenshotter {
|
||||
const cleanupHighlight = await this._maskElements(progress, options);
|
||||
progress.throwIfAborted(); // Avoid extra work.
|
||||
|
||||
const buffer = await this._page._delegate.takeScreenshot(progress, format, documentRect, viewportRect, options.quality, fitsViewport, options.scale || 'device');
|
||||
const quality = format === 'jpeg' ? options.quality ?? 80 : undefined;
|
||||
const buffer = await this._page._delegate.takeScreenshot(progress, format, documentRect, viewportRect, quality, fitsViewport, options.scale || 'device');
|
||||
progress.throwIfAborted(); // Avoid restoring after failure - should be done by cleanup.
|
||||
|
||||
await cleanupHighlight();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user