From f706c5fa932001176f357e0cfa2ca0ee1f147500 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Sun, 21 Mar 2021 10:52:17 +0100 Subject: [PATCH] Fix unable to close frame message --- src/browser_utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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.