From 96432884b3046260fc7b1dea054d312753ef7775 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Tue, 28 Dec 2021 21:32:58 +0100 Subject: [PATCH] stealth was not working due to removed `new` before `require`? HEAD was showing hcaptcha while commit 64d0ba8ce71baec3947d1b64acd567befcb39340 claimed successfully without one. Only relevant diff seems to be the removed `new` about which ts-check complained and which is also missing in the example in https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions. --- main.stealth.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.stealth.js b/main.stealth.js index 386901d..1b6002a 100644 --- a/main.stealth.js +++ b/main.stealth.js @@ -42,7 +42,7 @@ const newStealthContext = async (browser, contextOptions = {}) => { 'webgl.vendor', 'window.outerdimensions' ]; - const evasions = enabledEvasions.map(e => require(`puppeteer-extra-plugin-stealth/evasions/${e}`)); + const evasions = enabledEvasions.map(e => new require(`puppeteer-extra-plugin-stealth/evasions/${e}`)); const stealth = { callbacks: [], async evaluateOnNewDocument(...args) { @@ -60,6 +60,7 @@ const newStealthContext = async (browser, contextOptions = {}) => { (async () => { const browser = await chromium.launch({ channel: 'chrome', // https://playwright.dev/docs/browsers#google-chrome--microsoft-edge + headless: false, }); /** @type {import('playwright').BrowserContext} */ const context = await newStealthContext(browser, {