aw1875 / puppeteer-hcaptcha

A library to solve hcaptcha challenges that are automated within puppeteer. You can automatically set response values where they should be so the only thing left for you is submitting the page or you can get the response token.
https://www.npmjs.com/package/puppeteer-hcaptcha
138 stars 38 forks source link

hCaptcha solver do not work #7

Closed max-xoo closed 3 years ago

max-xoo commented 3 years ago

During my development it did not work, so I tested like the demo (same code and same site) and it does not work! So I can't use the package, here is the error:

UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON --> starting at object with constructor 'BrowserContext' | property '_browser' -> object with constructor 'Browser' --- property '_defaultContext' closes the circle at JSON.stringify ()

answer this issue for more information.

awxlfy commented 3 years ago

Which demo did you test out? I believe usually a circular json error from puppeteer has to do with how an element is selected/used. I've never encountered this issue so I would love to get to the bottom of it so I can push a fix for this if it is something on my end!

max-xoo commented 3 years ago

Ok look:

(node:2984) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'useragent' of undefined at solveCaptcha (C:\Users\maxen\Desktop\hcaptchaBypass\node_modules\puppeteer-hcaptcha\hcaptcha.js:215:63) at Page._onBindingCalled (C:\Users\maxen\Desktop\hcaptchaBypass\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:722:62) at C:\Users\maxen\Desktop\hcaptchaBypass\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:151:60 at C:\Users\maxen\Desktop\hcaptchaBypass\node_modules\puppeteer\lib\cjs\vendor\mitt\src\index.js:51:62 at Array.map ()

The code :

const puppeteer = require("puppeteer-extra")
const pluginStealth = require("puppeteer-extra-plugin-stealth")
const vision = require("@google-cloud/vision");

const { hcaptcha } = require("puppeteer-hcaptcha");

const client = new vision.ImageAnnotatorClient({
    keyFilename: "AIzaSyCJdMDnyd4JPJEiBPT545P504N85NfLVIQ",
});

puppeteer.use(pluginStealth());

(async () => {
    const browser = await puppeteer.launch({
        ignoreHTTPSErrors: true,
        headless: false,
        args: [
            `--window-size=600,1000`,
            "--window-position=000,000",
            "--disable-dev-shm-usage",
            "--no-sandbox",
            "--user-data-dir='/tmp/chromium'",
            "--disable-web-security",
            "--disable-features=site-per-process"
        ],
     });
    const [page] = await browser.pages();

    await page.goto("https://2captcha.com/demo/hcaptcha")
    await page.setDefaultNavigationTimeout(0);

    await hcaptcha(page, client);
})();

and useragents.json :

{}
max-xoo commented 3 years ago

is good, just me :lol: