Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(screenshot): avoid unnecessary work (#16035)

Dmitry Gozman03b0f911d99c
diff --git a/packages/playwright-core/src/server/screenshotter.ts b/packages/playwright-core/src/server/screenshotter.ts
index eebf4ab8c1..66eebc3d82 100644
--- a/packages/playwright-core/src/server/screenshotter.ts
+++ b/packages/playwright-core/src/server/screenshotter.ts
@@ -140,6 +140,9 @@ export class Screenshotter {
}
async _preparePageForScreenshot(progress: Progress, hideCaret: boolean, disableAnimations: boolean) {
+ if (!hideCaret && !disableAnimations)
+ return;
+
if (disableAnimations)
progress.log(' disabled all CSS animations');
await Promise.all(this._page.frames().map(async frame => {