puppeteer-extra
puppeteer-extra copied to clipboard
[Bug] Stealth extra not working with nowsecure.nl
Describe the bug
I searched for existing issues on this, but didn't find any. I'm just testing Stealth and associated extras to gain confidence before adding to my project. Whether I use headless 'new' or false, it hangs waiting for code to recognize and check "Verify you are human" checkbox (see below). I added puppeteer-extra-plugin-recaptcha
but didn't help. Wasn't sure if that was already included in puppeteer-extra-plugin-stealth
.
Code Snippet
import {Utils} from "../utils.ts"
import Chromium from "@sparticuz/chromium"
import puppeteer from 'puppeteer-extra'
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
import AdblockerPlugin from 'puppeteer-extra-plugin-adblocker'
import AnonimizeUA from 'puppeteer-extra-plugin-anonymize-ua'
import RecaptchaPlugin from 'puppeteer-extra-plugin-recaptcha'
// @ts-ignore
puppeteer.use(StealthPlugin()).use(AdblockerPlugin()).use(AnonimizeUA()).use(RecaptchaPlugin())
describe('Nowsecure', () => {
it('should launch and secure the browser', async () => {
console.log(`start test`)
const execpath = Utils.isdev() ? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" : await Chromium.executablePath()
// @ts-ignore
const browser = await puppeteer.launch({
executablePath: execpath,
headless: 'new',
timeout: 30000,
defaultViewPort: {width: 1280, height: 720},
})
const page = await browser.newPage()
await page.goto('https://nowsecure.nl/', {waitUntil: 'networkidle2'})
await page.waitForTimeout(5000)
await page.screenshot({path: 'image.png', fullPage: true})
await browser.close()
}, 30000)
})
Screen Shot
Versions
System:
OS: macOS 13.5.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 940.78 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.17.0/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
npmPackages:
puppeteer-core: ^21.1.0 => 21.1.0
puppeteer-extra: ^3.3.6 => 3.3.6
puppeteer-extra-plugin-adblocker: ^2.13.6 => 2.13.6
puppeteer-extra-plugin-stealth: ^2.11.2 => 2.11.2
Hello,
for the issue with Captcha i would recommend just using 2captcha or deathofcaptcha API. Greetings
I can recreate this.
Steps:
-
Have Puppeteer launch Chrome in NON-headless and open a New Tab. Then have it delay indefinitely, so you can manually manipulate the browser. You should now have the initial tab without Puppeteer active, and the new tab that Puppeteer created.
-
In the Puppeteer tab, go to the website manually. Try to solve the Captcha manually, and it will continuously fail.
-
In the initial tab (Puppeeter not active here), try to go to the website manually. Try to solve the Captcha manually and it will pass.
-
Go back to the Puppeteer tab, try to solve the Captcha manually and it will pass but ONLY after passing in the non-puppeteer tab. I'm assuming this is because it's passing the valid cookie from the non-puppeteer tab. Unfortunately, for most use cases this isn't an option. It seems it's somehow detecting puppeteer itself in that tab.
It also fails with fintel.io.
I also managed to pass manually with the steps provided by @wlc108