How to automatically solve Invisible reCAPTCHA V2?

#1
1629880424598.png

reCAPTCHA V2 also has an invisible version.

You may check how it looks like here: https://www.google.com/recaptcha/api2/demo?invisible=true
Recently we noticed some changes in invisible reCAPTCHA algorithms on few websites and added new parameterinvisible=1 that should be used for invisible reCAPTCHA.
Read more about invisible reCAPTCHA below.

Invisible reCAPTCHA is located on a DIV layer positioned -10 000 px from top that makes it invisible for user.

reCAPTCHA is activated on page load or on user's actions like click somewhere or submit a form - that depends on the website. If user's cookies are good enough then he will just pass it automatically and no additional actions will be required. Otherwise user will see standard reCAPTCHA form with a challenge.

In most cases when challenge is completed a callback function is executed. You can read more about callback here.

If you are still not sure — there are few ways to determine that reCAPTCHA is in invisible mode:
  • You don't see "I'm not a robot" checkbox on the page but getting recaptcha challenge when making some actions there
  • reCAPTCHA's iframe link contains parameter size=invisible
  • reCAPTCHA's configuration object contains parameter size that is set to invisible, for example ___grecaptcha_cfg.clients[0].aa.l.size is equal to invisible
How to bypass invisible reCAPTCHA in browser?
Method 1: using javascript:

  1. Change the value of g-recaptcha-response element to the token you received from our server:
    document.getElementById("g-recaptcha-response").innerHTML="TOKEN_FROM_2CAPTCHA";
  2. Execute the action that needs to be performed on the page after solving reCAPTCHA.
  3. Usually there's a form that should be submitted and you need to identify the form by id or name or any other attribute and then submit the form. Here are few examples:
  4. Code:
    document.getElementById("recaptcha-demo-form").submit(); //by id "recaptcha-demo-form"
    document.getElementsByName("myFormName")[0].submit(); //by element name "myFormName"
    document.getElementsByClassName("example").submit(); //by class name "example"
    Or sometimes there's a callback function executed when reCAPTCHA is solved.
    Callback function is usually defined in data-callback parameter of reCAPTCHA, for example:
    data-callback="myCallbackFunction"

    Or sometimes it's defined as callback parameter of grecaptcha.render function, for example:
    Code:
    grecaptcha.render('example', {
    
      'sitekey' : 'someSitekey',
    
      'callback' : myCallbackFunction,
    
      'theme' : 'dark'
    
    });
    And all you have to do is to call that function:
    myCallbackFunction();

  5. Voila! You've done that with just 2 strings of code.

Method 2: changing HTML:
  1. Cut the div containing reCAPTCHA from page body.
  2. Code:
    <div style="visibility: hidden; position: absolute; width:100%; top: -10000px; left: 0px; right: 0px; transition: visibility 0s linear 0.3s, opacity 0.3s linear; opacity: 0;">
    <div style="width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; z-index: 2000000000; background-color: #fff; opacity: 0.5;  filter: alpha(opacity=50)">
    </div>
    <div style="margin: 0 auto; top: 0px; left: 0px; right: 0px; position: absolute; border: 1px solid #ccc; z-index: 2000000000; background-color: #fff; overflow: hidden;">
    <iframe src="https://www.google.com/recaptcha/api2/bframe?hl=en&amp;v=r20170213115309&amp;k=6LfP0CITAAAAAHq9FOgCo7v_fb0-pmmH9VW3ziFs#zglq3yifgkmj" title="recaptcha challenge" style="width: 100%; height: 100%;" scrolling="no" name="zglq3yifgkmj" frameborder="0"></iframe>
    </div>
    </div>
  3. Cut the whole block:
  4. Code:
    <div class=""><!-- BEGIN: ReCAPTCHA implementation example. -->
    <div id="recaptcha-demo" class="g-recaptcha" data-sitekey="6LfP0CITAAAAAHq9FOgCo7v_fb0-pmmH9VW3ziFs" data-callback="onSuccess" data-bind="recaptcha-demo-submit"><div class="grecaptcha-badge" style="width: 256px; height: 60px; transition: right 0.3s ease 0s; position: fixed; bottom: 14px; right: -186px; box-shadow: 0px 0px 5px gray;"><div class="grecaptcha-logo"><iframe src="https://www.google.com/recaptcha/api2/anchor?k=6LfP0CITAAAAAHq9FOgCo7v_fb0-pmmH9VW3ziFs&amp;co=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbTo0NDM.&amp;hl=en&amp;v=r20170213115309&amp;size=invisible&amp;cb=uror1hlow5a" title="recaptcha widget" scrolling="no" name="undefined" width="256" height="60" frameborder="0"></iframe></div><div class="grecaptcha-error"></div><textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 40px; border: 1px solid #c1c1c1; margin: 10px 25px; padding: 0px; resize: none;  display: none; "></textarea></div></div>
    <script>
        var onSuccess = function (response) {
            var errorDivs = document.getElementsByClassName("recaptcha-error");
            if (errorDivs.length) {
                errorDivs[0].className = "";
            }
            var errorMsgs = document.getElementsByClassName("recaptcha-error-message");
            if (errorMsgs.length) {
                errorMsgs[0].parentNode.removeChild(errorMsgs[0]);
            }
            document.getElementById("recaptcha-demo-form").submit();
        };
    </script><!-- Optional noscript fallback. --><!-- END: ReCAPTCHA implementation example. --></div>
  5. Put the following code instead of the block you've just cut:
  6. Code:
    <input type="submit">
    <textarea name="g-recaptcha-response">%g-recaptcha-response%</textarea>
    Where %g-recaptcha-response% - is an answer token you’ve got from our service.
  7. You will see “Submit query” button.
    Press the button to submit the form with g-recaptcha-response and all other form data to the website.
Request URL example:
http://2captcha.com/res.php?key=1abc234de56fab7c89012d34e56fa7b8&action=get&id=2122988149