How 2captcha/puppeteer-recaptcha-solver-using-clicks works
Purpose and Entry Point
A Node.js demonstration automates reCAPTCHA v2 image-grid challenges through Puppeteer and the 2Captcha Grid API. index.js is the execution entry point; captchaSolver.js coordinates browser interaction, extraction, external solving, and click replay.
Browser Automation Boundary
Puppeteer drives a live target page and interacts with reCAPTCHA’s nested widget/challenge frames. Frame discovery and challenge-state checks isolate the fragile browser/third-party DOM boundary:
• utils/isFoundReCaptchaBadge.js
• utils/isFoundRecaptchaChallengeFrame.js
• utils/isRecaptchaPassed.js
Challenge Extraction Stage
Once a challenge frame is available, an in-page extractor obtains grid dimensions, task instruction, and image payload suitable for 2Captcha’s GridTask request. Extraction is initialized/injected separately from parameter collection:
• utils/initCaptchaParamsExtractor.js
• utils/getCaptchaParams.js
• captchaSolver.js
External Solver Integration
The extracted challenge is submitted to 2Captcha using the API key supplied via APIKEY (or code fallback). The solver result encodes selected grid cells, e.g. click:3/6/8; this is the principal external-service boundary and can return unsolvable/error outcomes.
• captchaSolver.js
• package.json
Solution Translation and Click Replay
Solver cell numbers are translated into grid coordinates based on extracted row/column dimensions. Puppeteer then performs coordinate-based clicks in the challenge frame, with randomized offsets/timing intended to resemble user interaction:
• utils/clickAtCoordinates.js
• utils/getRandomNumber.js
• utils/showClickInfo.js
Verification and Iteration
After replaying selected cells, automation activates the reCAPTCHA Verify control and checks whether the widget has passed. The architecture expects multiple sequential image tasks before completion; challenge refresh handling and stronger error recovery are not yet implemented.
• utils/clickRecaptchaVerifyButton.js
• utils/isRecaptchaPassed.js
• captchaSolver.js
Runtime and Dependencies
The project runs under Node.js via the npm start command defined in package.json. It depends on Puppeteer for Chromium/browser control and reaches 2Captcha over its remote API. Demonstration assets are non-runtime documentation:
• package.json
• index.js
• media/bypass_recaptcha_v2.gif
Main entry points: captchaSolver.js Captcha solver coordinator · clickAtCoordinates.js Coordinate click replay · index.js Execution entry · isFoundRecaptchaChallengeFrame.js Widget frame discovery
Components 14
Node.js Runtime
- npm start & dependencies · Defines Node.js startup and Puppeteer dependency.
package.json - Execution entry
index.js
Browser / reCAPTCHA
- Puppeteer / Chromium
- Target page
- Widget frame discovery · Finds badge and nested challenge frames.
utils/isFoundRecaptchaChallengeFrame.js - Challenge pass check
utils/isRecaptchaPassed.js - Verify control
utils/clickRecaptchaVerifyButton.js
Solve Pipeline
- Captcha solver coordinator · Coordinates extraction, submission, replay, and iterative verification.
captchaSolver.js - Extractor injection
utils/initCaptchaParamsExtractor.js - Grid challenge parameters · Collects grid dimensions, instruction, and image payload.
utils/getCaptchaParams.js - Coordinate click replay · Maps solver cell numbers to grid coordinates and clicks them.
utils/clickAtCoordinates.js - Human-like timing
utils/getRandomNumber.js - Click diagnostics
utils/showClickInfo.js
External Service
- 2Captcha Grid API · Returns selected grid cells or an error/unsolvable result.
Connections 17
- npm start & dependencies → Execution entry: npm start
- Execution entry → Captcha solver coordinator: starts
- Captcha solver coordinator → Puppeteer / Chromium: controls
- Puppeteer / Chromium → Target page: loads
- Captcha solver coordinator → Widget frame discovery: locates challenge
- Widget frame discovery → Target page: inspects nested frames
- Captcha solver coordinator → Extractor injection: injects
- Extractor injection → Grid challenge parameters: enables collection
- Grid challenge parameters → 2Captcha Grid API: GridTask request
- 2Captcha Grid API → Coordinate click replay: selected cells
- Coordinate click replay → Human-like timing: uses offsets and delays
- Coordinate click replay → Click diagnostics: reports clicks
- Coordinate click replay → Puppeteer / Chromium: replays in frame
- Captcha solver coordinator → Verify control: after replay
- Verify control → Puppeteer / Chromium: clicks control
- Captcha solver coordinator → Challenge pass check: checks completion
- Challenge pass check → Captcha solver coordinator: repeat if pending · Sequential image tasks may require another solve cycle.