From bbc2e306f4f502691e1ad49231d3a504c64d574e Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Wed, 13 Nov 2024 12:14:26 +0000 Subject: [PATCH] Add waitUntil option to page.setContent for improved reliability in screenshot capture --- Common/Server/Utils/Browser.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Common/Server/Utils/Browser.ts b/Common/Server/Utils/Browser.ts index a4fa450007..be0ddd1dad 100644 --- a/Common/Server/Utils/Browser.ts +++ b/Common/Server/Utils/Browser.ts @@ -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();