Add waitUntil option to page.setContent for improved reliability in screenshot capture

This commit is contained in:
Simon Larsen 2024-11-13 12:14:26 +00:00
parent 03e063c35b
commit bbc2e306f4
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA

View File

@ -30,7 +30,9 @@ export default class BrowserUtil {
const page: Page = pageAndBrowser.page;
const browser: Browser = pageAndBrowser.browser;
await page.setContent(html);
await page.setContent(html, {
waitUntil: "domcontentloaded",
});
const screenshot: Buffer = await page.screenshot({ type: "png" });
await browser.close();