Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to detect verification code [Bug] #868

Open
yangfan-coder opened this issue Jan 10, 2024 · 0 comments
Open

Unable to detect verification code [Bug] #868

yangfan-coder opened this issue Jan 10, 2024 · 0 comments
Labels
issue: bug report A bug has been reported needs triage

Comments

@yangfan-coder
Copy link

Hello, I am trying to https://juejin.cn/ I tried to log in, but the plugin couldn't capture any relevant information. I wonder if there was an issue with my writing? It's still a configuration issue. Could you please help me take a look

I have referred to # 622 but have not received any valid information

Code

index.js

const puppeteer = require("puppeteer-extra");
const RecaptchaPlugin = require("puppeteer-extra-plugin-recaptcha");
puppeteer.use(
  RecaptchaPlugin({
    provider: {
      id: "2captcha",
      token: "xxxx",
    },
    visualFeedback: true,
  })
);

function waitFor(t) {
  return new Promise((r) => setTimeout(r, t));
}

puppeteer
  .launch({
    headless: false,
    devtools: true,
    args: [
      "--disable-features=IsolateOrigins,site-per-process",
      "--flag-switches-begin --disable-site-isolation-trials --flag-switches-end",
      "--disable-web-security",
    ],
  })
  .then(async (browser) => {
    const page = await browser.newPage();
    await page.goto("https://juejin.cn/");
    page.setDefaultTimeout(100000);

    const loginbutton = await page.$(".login-button");
    await page.evaluateHandle(async (element) => {
      function waitFor(t) {
        return new Promise((r) => setTimeout(r, t));
      }

      if (element) {
        element.click();
        await waitFor(1000);
        let clickable = document.querySelector(".clickable");
        clickable && clickable.click();
      }
    }, loginbutton);

    await waitFor(1000);
    await page.type('input[name="loginPhoneOrEmail"]', "13032014099");
    await page.type('input[name="loginPassword"]', "xxxxxx");


    await page.solveRecaptchas();
    for (const frame of page.mainFrame().childFrames()) {
      await frame.solveRecaptchas();
    }
    await Promise.all([page.waitForNavigation(), page.click(`.btn.btn-login`)]);
  });

Package.json

{
  "name": "puppetee_demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "puppeteer": "^21.7.0",
    "puppeteer-core": "^16.2.0",
    "puppeteer-extra": "^3.3.6",
    "puppeteer-extra-plugin-recaptcha": "^3.6.8",
    "puppeteer-extra-plugin-stealth": "^2.11.2"
  }
}

Debug Log
I didn't get any valid information from the log!

puppeteer-extra plugin registered recaptcha +0ms
  puppeteer-extra no dependencies are missing +1ms
  puppeteer-extra orderPlugins:before [ 'recaptcha' ] +0ms
  puppeteer-extra orderPlugins:after [ 'recaptcha' ] +0ms
  puppeteer-extra-plugin:recaptcha onPageCreated about:blank +0ms
  puppeteer-extra-plugin:recaptcha solveRecaptchas +0ms
  puppeteer-extra-plugin:recaptcha findRecaptchas +0ms
  puppeteer-extra-plugin:recaptcha hasRecaptchaScriptTag false +0ms
  puppeteer-extra-plugin:recaptcha hasHcaptchaScriptTag false +0ms
  puppeteer-extra-plugin:recaptcha _generateContentScript recaptcha findRecaptchas undefined +0ms
  puppeteer-extra-plugin:recaptcha:cs Intialized {"url":"https://juejin.cn/","opts":{"visualFeedback":true,"debugBinding":"___pepr_cs"}} +0ms
  puppeteer-extra-plugin:recaptcha:cs findRecaptchas {"url":"https://juejin.cn/","hasClients":false} +1ms
  puppeteer-extra-plugin:recaptcha _generateContentScript hcaptcha findRecaptchas undefined +0ms
  puppeteer-extra-plugin:recaptcha Filter results: 0 of 0 captchas filtered from results. +0ms
  puppeteer-extra-plugin:recaptcha findRecaptchas { captchas: [], filtered: [], error: null } +0ms
  puppeteer-extra-plugin:recaptcha solveRecaptchas { captchas: [], filtered: [], solutions: [], solved: [], error: null } +0ms

Screenshot

image

Versions

System:
OS: macOS 11.4
Binaries:
Node: v16.20.0 - /usr/local/bin/node
npm: 8.19.4 - /usr/local/bin/npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue: bug report A bug has been reported needs triage
Projects
None yet
Development

No branches or pull requests

1 participant