Problem with invisible ReCaptcha v2 callback function at Mail.com Sign-up page

#1
Hi,

I've been having problems with finding & successfully calling the invisible ReCaptcha v2 callback function at Mail.com Sign-up page (the actual url is "https://signup.mail.com/?edition=int&lang=en#.1258-header-signup2-1").

I'm using 2Captcha service to solve this invisible ReCaptcha v2, while having thoroughly read and following all their API documentation & code examples (for Python 3 in my case).

I have tried both with & without the "invisible=1" parameter passed to the "http://2captcha.com/in.php" API endpoint but the result is the same.

The ReCaptcha gets solved by 2Captcha agents and I finally get the 2CAPTCHA_RESPONSE code.
I have found the hidden ("display: none") textarea with id/name="g-recaptcha-response" in the html, and I enter the received 2CAPTCHA_RESPONSE code into its innerHTML.

The next step (based on the 2Captcha API docs) is to find & call the ReCaptcha callback function.
And here my problem starts..

I have searched for a named callback function in the Mail.com html & js source code but haven't found one.
So, I guessed it must be an anonymous function.
Using Chrome Dev Tools I inspected the various js objects and have found something that maybe is the callback function:
___grecaptcha_cfg.clients[0].Gq.X.callback

But whenever I try to call:
___grecaptcha_cfg.clients[0].Gq.X.callback("2CAPTCHA_RESPONSE")
I get -> undefined


I have spent countless hours trying to find a solution to make Mail.com Sign-up page get the solved ReCaptcha (display the green checkmark) but without luck.

Please, any help would be much appreciated.

Thank you in advance!
 
#2
For anyone browsing the forum and having a similar problem to mine...

I managed to solve this with the help of the GREAT support guys over at 2Captcha.com!!!
(HIGHLY RECOMMENDED service & support! I mean it!!!)

To make the long story short...
If you have a situation with:
  • Invisible ReCaptcha v2, where there is no named callback function defined anywhere (not mentioned in the html, nor present in the js source code).
  • No form submit button anywhere (not visible or invisible, nor dynamically generated by js).
  • You want to use 2Captcha service to automatically solve it and proceed to posting the form.

If that's your case, then follow the steps below:
  1. Using Chrome/Firefox Dev Tools -> Console
    1. Manually inspect the existing js object structure by typing:
      ___grecaptcha_cfg.clients
      This is an array of all the recaptcha objects currently created on the page. More often than not, there will be only one. So, that's index [0].
    2. Manually inspect the objects of the above array. In my situation there was only one:
      ___grecaptcha_cfg.clients[0]
      Still using the Console, inspect & try to find the object ___grecaptcha_cfg.clients[0].Gq.X
      NOTE: "Gq.X" may be different in your case. For example, in 2Captcha's API documentation they are referring to it as "aa.l".
      Traverse the object tree and you'll know that you found it when you see the property "sitekey" and the function "callback" listed under it in the tree.
    3. Take a note of the object name of your case (in my case it was "Gq.X").
    4. Take note of the sitekey string.

  2. Contact the 2Captcha API endpoint "http://2captcha.com/in.php" passing:
    1. Your personal 2Captcha API Key.
    2. The parameter "method=userrecaptcha"
    3. The parameter "invisible=1"
    4. The parameter "googlekey=SITE_KEY" (the sitekey that you found in step 1.4)
    5. The parameter "pageurl=FULL_URL_OF_THE_TARGET_PAGE" (the full url where the captcha is located)

  3. Wait for their successful response, and when that happens get the response token text (all characters after the "OK|").

  4. In the HTML source code of the target webpage search and find the hidden <textarea> element which has "display: none" & id/name="g-recaptcha-response".
    1. Type/Inject into its innerHTML the 2Captcha response token text (from step 3).

  5. Manually (through the Chrome/Firefox Dev Tools -> Console) or Programmatically (through browser automation such as Selenium) execute the following javascript code:
    ___grecaptcha_cfg.clients[0].Gq.X.callback("2CAPTCHA_RESPONSE")
    DON'T forget to replace:
    • "Gq.X" with the actual object name of your case (see step 1.3)
    • 2CAPTCHA_RESPONSE is the 2Captcha response token text (from step 3)

  6. Manually submit the main form of the target webpage, or click the main button to proceed to the next page (if there's no submit button).
    At this stage the page will get the solved captcha correctly and continue normally (given that you have provided valid data to any other form field that was required by this form/webpage).

  7. Rock on!!! We're done!..


Note:
Don't be silly as I was, and wait to see the green checkmark animation happening on the visible captcha div.
It won't happen and that's expected. The captcha is already considered solved as far as the webpage is concerned.
Nor expect to see anything returned after you manually (or programmatically) execute the callback function (in step 5).
Specifically, if you manually execute it in the Console you will see "undefined" returned. That's expected too. The callback function doesn't return any value anyways.


I hope this post will help anyone being in the difficult situation that I've been for the past 12 hours tearing my hair apart, while digging hundreds of js lines of obfuscated code trying to find the damn recaptcha callback function!

Have a nice day guys!
 
Last edited: