CAPTCHAFORUM
Administrator
https://2captcha.com/blog/goolge-recaptcha-solver-puppeteer-and-auto-fill
In this article, we've developed a detailed guide on how to bypass reCAPTCHA using Puppeteer and fully auto fill method.
Learn how to automatically solve Google captcha reCAPTCHA using Puppeteer and the auto filler in this step-by-step guide.
Auto reCAPTCHA Solving Using Puppeteer and Auto Filler
This article demonstrates how to automate image-based reCAPTCHA bypass challenges (3x3 or 4x4 grids) using the reCAPTCHA solver and Puppeteer lib using Puppeteer and the 2Captcha (captcha solver).The script programmatically engages with reCAPTCHA, captures the challenge, sends it to captcha solver API for solving, and then mimics human like interactions by clicking on the provided solution.
This method automates the entire process, allowing for seamless CAPTCHA bypassing in web automation tasks.
Installation and Usage
To use this script, clone the repository, install the necessary dependencies, and run the provided example.This will set up the environment and demonstrate how to bypass reCAPTCHA automatically with the script in action.
Here's how:
Code:
# Clone the repository
git clone git@github.com/2captcha/puppeteer-recaptcha-solver-using-clicks.git
cd puppeteer-recaptcha-solver-using-clicks
# Install dependencies
npm install
# Run the script
npm run start`
Configuration
To use the script, you'll need to configure your 2Captcha API key. Set the APIKEY environment variable as follows:
Code:
export APIKEY=your_api_key
How It Works
This script uses the grid-based method to solve reCAPTCHA challenges. Here's a step-by-step breakdown of how it works:- Extracting the CAPTCHA: The reCAPTCHA challenge image and necessary parameters are extracted programmatically.
- Sending Data: The image data is sent to the API, where it’s solved using the grid method (e.g., identifying which cells contain the correct objects).
- Clicking: After receiving the solution, which includes the grid cell numbers to click, Puppeteer simulates user interaction by clicking the specified cells within the reCAPTCHA widget. Finally, the script clicks the Verify button to complete the challenge.
Code:
{
rows: 3,
columns: 3,
type: 'GridTask',
comment: 'Select all images with crosswalks Click verify once there are none left',
body: 'XXXXXXXX'
}
Example of a response after solving the reCAPTCHA:
Code:
{ status: 1, data: 'click:3/6/8', id: 'XXXXXXXX' }
In the response click:3/6/8, the numbers represent the grid cells that need to be clicked. The response click:3/6/8 means you should click on the CAPTCHA squares numbered 3, 6, and 8. The cells are numbered starting from the top-left corner, moving left to right, row by row. In the screenshot below, you can visually identify which squares correspond to the response click:3/6/8.
For the response click:3/6/8, you would click the squares in the third, sixth, and eighth positions.
Typically, to fully solve a CAPTCHA, you need to pass around 1-5 challenges. However, in more complex cases, there might be additional tasks to complete.
Pros
- Token-Free Verification: You don’t need to manually manage or inject the token into the web page. This method mimics human behavior by clicking the correct areas in the CAPTCHA.
- Simplified Logic: The approach takes advantage of the built-in reCAPTCHA verification, so you don't have to worry about complex token management.
Some sites may add extra security layers such as tracking data or complex token logic, making it harder to bypass reCAPTCHA using tokens. This click-through approach is ideal when token-based bypassing becomes too complicated.
Cons
- Increased Complexity: The method requires more code and additional time to handle interactions.
- Variable Cost and Speed: The cost and time to solve CAPTCHAs can vary depending on the complexity of each image challenge.
- Browser Automation Dependency: This approach relies on browser automation (e.g., Puppeteer) to properly execute reCAPTCHA bypass logic. Automation ensures that the reCAPTCHA token is applied correctly.
Error Handling
- ERROR_CAPTCHA_UNSOLVABLE: Sometimes, a CAPTCHA is too difficult for 2Captcha to solve, resulting in this error. You should implement error-handling logic to retry the request or escalate if this happens.
- Blocking by reCAPTCHA: If you make too many attempts from the same IP address, reCAPTCHA may block your requests temporarily. You can resolve this by either changing your IP address or waiting a few minutes. If reCAPTCHA blocks you, you’ll see the following message: Try again later. Your computer or network may be sending automated queries. To protect our users, we can't process your request right now.