Skip to content

Commit 40d3a0f

Browse files
committed
Capture only container when screenshotting
1 parent 0b036fb commit 40d3a0f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/sitemap-visual-diff.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,12 @@ async function screenshotFullPage(page: any, url: string, outputPath: string) {
110110
});
111111
await page.waitForTimeout(500);
112112
await fs.promises.mkdir(path.dirname(outputPath), { recursive: true });
113-
await page.screenshot({ path: outputPath, fullPage: true });
113+
const container = await page.$("div.container");
114+
if (container) {
115+
await container.screenshot({ path: outputPath });
116+
} else {
117+
await page.screenshot({ path: outputPath, fullPage: true });
118+
}
114119
}
115120

116121
function compareImages(

0 commit comments

Comments
 (0)