diff --git a/src/browser_utils.js b/src/browser_utils.js index a021f0e5..033673a8 100644 --- a/src/browser_utils.js +++ b/src/browser_utils.js @@ -337,11 +337,13 @@ async function createUserProfileDir(config) { /** * Get the text content of an error or warning page inserted by the browser. * The most common one is a page for an HTTPS-Error or lack of HTTPS. - * @param {import('puppeteer').Page} page + * @param {import('puppeteer').Page | import('puppeteer').Frame} pageOrFrame * @param {Error} error * @param {Promise} */ -async function enhanceError(config, page, error) { +async function enhanceError(config, pageOrFrame, error) { + const page = pageOrFrame._frameManager._page; + // Frames don't have an isClosed() if (!page.isClosed()) { // Check if the page is injected by the browser like for an insecure // form submission in Chrome.