Skip to main content

Solve Recaptcha v2

Solves Google reCAPTCHA v2 challenges and returns a response token. reCAPTCHA v2 is the familiar "I'm not a robot" checkbox captcha used on millions of websites worldwide.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Session - The session ID returned from the Create Session node.
  • Website URL - The full URL of the target page where the reCAPTCHA appears (e.g., https://example.com/login).
  • Website Key - The site key (data-sitekey parameter) found in the page source. Format: 6Le-wvkSAAAAAPBMRTvw0Q4M....

Options

  • Data-s Value - Optional value of the data-s parameter if required by the site. This is an additional security parameter used by some implementations.
  • No Cache - Disable result caching for this task. Default is false. Set to true to force a fresh solve.

Output

  • Token - The g-recaptcha-response token to submit with your form or API request.

How It Works

The Solve Recaptcha v2 node solves Google's reCAPTCHA v2 challenges. When executed, it:

  1. Retrieves the session using the provided session ID
  2. Creates a reCAPTCHA v2 solving task with the website URL and site key
  3. Optionally adds the data-s value if provided
  4. Sends the task to CapMonster Cloud for processing
  5. Waits for the challenge to be solved (including image selection if required)
  6. Returns the g-recaptcha-response token

Requirements

  • A valid CapMonster session (from Create Session node)
  • The full URL where the reCAPTCHA is displayed
  • The reCAPTCHA site key from the page source
  • Sufficient account balance
  • Active internet connection

Error Handling

The node will fail in the following cases:

  • Missing or invalid session ID
  • Session not found
  • Empty or invalid website URL
  • Empty or invalid site key
  • Insufficient account balance
  • Invalid data-s value format
  • Network connectivity issues
  • Captcha solving timeout
  • Unsupported reCAPTCHA configuration

Finding reCAPTCHA Parameters

To find the required parameters, inspect the page source:

Website URL

Use the full URL of the page where the captcha appears:

https://example.com/login

Site Key (data-sitekey)

Look for the reCAPTCHA widget in the HTML:

<div class="g-recaptcha" data-sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq5bi0DJwx_mJ-"></div>

Or in JavaScript:

grecaptcha.render('recaptcha-container', {
'sitekey': '6Le-wvkSAAAAAPBMRTvw0Q4Muexq5bi0DJwx_mJ-'
});

You can also inspect the iframe:

<iframe src="https://www.google.com/recaptcha/api2/anchor?k=6Le-wvkSAAAAAPBMRTvw0Q4M...">

Data-s Value (Optional)

Some sites use an additional data-s parameter:

<div class="g-recaptcha"
data-sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq5bi0DJwx_mJ-"
data-s="additional_data_value">
</div>

Usage Notes

  • reCAPTCHA v2 solving typically takes 15-40 seconds
  • The response token is valid for approximately 2 minutes
  • Use the token immediately after receiving it
  • The No Cache option forces a fresh solve, useful for testing
  • Tokens are single-use only
  • Some reCAPTCHA v2 challenges are easier (checkbox only), others require image selection

Example: Solving reCAPTCHA v2 on Login Form

Inputs:

  • Session: (from Create Session node)
  • Website URL: https://example.com/login
  • Website Key: 6Le-wvkSAAAAAPBMRTvw0Q4Muexq5bi0DJwx_mJ-

Options:

  • Data-s Value: (leave empty if not required)
  • No Cache: false

Output:

  • Token: "03AGdBq24PBCbwiDRaS9b7T..."

Example: Complete Flow

Create Session (API Key)
→ Browser: Navigate to login page
→ Browser: Fill username and password
→ Browser: Get Attribute (data-sitekey from recaptcha element)
→ Solve Recaptcha v2
→ Browser: Execute Script (set g-recaptcha-response)
→ Browser: Click submit button

Submitting the Token

After receiving the token, you need to submit it with your form. Common methods:

Method 1: Hidden Form Field

document.getElementById('g-recaptcha-response').value = token;

Method 2: Using reCAPTCHA Callback

// Set up callback
window.recaptchaCallback = function(token) {
console.log('Token received:', token);
// Submit form
};

Method 3: API Request

{
"username": "user@example.com",
"password": "password123",
"g-recaptcha-response": "token_here"
}

Method 4: Direct Textarea Update

document.querySelector('[name="g-recaptcha-response"]').innerHTML = token;
document.querySelector('form').submit();

Best Practices

  • Cache the site key to avoid repeated DOM queries
  • Validate the token format before submission (starts with "03")
  • Implement retry logic for failed solves
  • Add random delays to mimic human behavior
  • Monitor solve times and set appropriate timeouts
  • Test with No Cache enabled during development
  • Verify the website URL matches exactly (including protocol)
  • Handle both checkbox-only and image challenge scenarios

Common Issues and Solutions

Issue: Invalid site key error

  • Solution: Verify the site key is complete (usually 40 characters)
  • Solution: Check if the key changes dynamically
  • Solution: Ensure you're on the correct page/domain
  • Solution: Look for multiple reCAPTCHA instances

Issue: Token not accepted by website

  • Solution: Verify you're setting g-recaptcha-response correctly
  • Solution: Check if the token has expired (2-minute validity)
  • Solution: Ensure the Website URL exactly matches the page URL
  • Solution: Try including the data-s value if present

Issue: "Invalid domain" error

  • Solution: The Website URL must match the domain registered with the site key
  • Solution: Include the full URL with protocol (https://)
  • Solution: Check for subdomain mismatches

Issue: Solving takes too long

  • Solution: reCAPTCHA v2 with image challenges takes longer (30-40 seconds)
  • Solution: Check CapMonster Cloud service status
  • Solution: Verify your internet connection
  • Solution: Implement timeout handling

Issue: Token validation failed on submit

  • Solution: Submit the token immediately (before expiration)
  • Solution: Don't modify the token value
  • Solution: Ensure you're submitting to the correct endpoint
  • Solution: Check if the form has additional validation

When to Use Data-s Value

The data-s parameter is required when:

  • You see data-s attribute in the reCAPTCHA div
  • Standard solving returns tokens that aren't accepted
  • The site uses additional reCAPTCHA security features
  • You encounter "invalid data-s" errors
  • The reCAPTCHA implementation is enterprise-grade

To find the data-s value:

// Execute in browser console
document.querySelector('.g-recaptcha').getAttribute('data-s');

reCAPTCHA v2 Types

There are two main types of reCAPTCHA v2:

Checkbox ("I'm not a robot")

  • Simpler challenge
  • May not require image selection
  • Faster solving time (15-20 seconds)
  • Lower difficulty

Image Challenge

  • Requires image selection (traffic lights, crosswalks, etc.)
  • Longer solving time (30-40 seconds)
  • Higher difficulty
  • More expensive to solve

Cost Considerations

  • reCAPTCHA v2 is moderately priced
  • Image challenges cost more than checkbox-only
  • Check CapMonster Cloud pricing for current rates
  • Monitor balance for large-scale operations
  • Consider caching (No Cache = false) for efficiency

Invisible reCAPTCHA v2

Some sites use invisible reCAPTCHA v2, which:

  • Has no visible checkbox
  • Triggers automatically
  • Uses the same solving approach
  • Requires the same parameters
  • May have different token submission methods

Advanced Tips

  • reCAPTCHA difficulty varies by user reputation and behavior
  • Google may serve easier challenges at different times
  • Token format: 03XXXX... (v2) vs 05XXXX... (invisible)
  • Some implementations use multiple reCAPTCHAs per page
  • Always test thoroughly with actual website behavior
  • Consider implementing a fallback to v3 if available
  • Monitor solve success rates and adjust strategy accordingly