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

reformedot

New member
EDIT: Now it's working, I managed to execute: window.grecaptcha.execute() after setting my captcha response and it bypassed the captcha!

Thanks Mark for your support and fast reply!
 

landrbot

New member
No idea unless you provide a link to the website :)

Hey Mark, I'm having a similar issue and would like to ask for your assistance. I'm executing ___grecaptcha_cfg.clients[0]J.J.callback(TOKEN) on Spotify's registration page but it's now saying "javascript error: Cannot read property 'J' of undefined" in my code. Yet, when I go to the registration page and load the console I'm able to find the callback with ___grecaptcha_cfg.clients[0]J.J.callback. Note, this code worked earlier yesterday and the object is still the same on the targeted site.. Do you know why I'm getting this error all of a sudden or what I can do to bypass this? Thanks you so much!
 

landrbot

New member
This is what I get in my program:
Screen Shot 2020-06-09 at 9.42.16 PM.png

This is what I get in Chrome Console via Spotify Registration
Screen Shot 2020-06-09 at 9.42.05 PM.png
 

selena98

New member
Hi guys!
Try to use this code to identify captchas on the page and find callbacks
https://gist.github.com/2captcha/2ee70fa1130e756e1693a5d4be4d8c70
I tried:
__grecaptcha_cfg.clients[0].$.$.callback()
__grecaptcha_cfg.clients[0].$.$.recaptchaCallback()
__grecaptcha_cfg.clients[0].$.$.callback.recaptchaCallback()
Everything "is not a function". I don't know what I'm doing wrong.

1592442432985.png


This is when I put recaptchaCallback in console

1592444116191.png


And this is just endless if I try to go down the tree. If I click the button next to the g() it goes to this function

JavaScript:
function ka(a){var d;a.has("csrfmiddlewaretoken")&&(d=a.get("csrfmiddlewaretoken"));return void 0!==d?d:void 0};function la(a){function d(c,g){g=String(g.getAttribute("data-callback"));"null"!==g&&(window[g]=function(){c.R=!0;c.o()})}var b={name:"",a:"",B:"",P:!1,v:!1,h:!1,O:!1,u:!0,fa:!1,F:!1,na:"",R:!1,N:a,D:function(){b.B=String(a.tagName.toLowerCase());var c=b.da();b.name=null!==c?c:"";b.a=b.name;if("captcha"===a.getAttribute("data-type"))b.F=!0,d(b,a);else{var g=String(a.getAttribute("id")).split("_"),f=g[g.length-1];var e=["day","month","year"];c=!1;if(-1<e.indexOf(f))for(g.pop(),g=g.join("_"),c=!0,e=r(e),f=e.next();!f.done;f=e.next())null===document.querySelector("#"+(g+"_"+f.value))&&(c=!1);c&&(b.fa=!0,c=String(a.getAttribute("id")).split("_"),c.shift(),c.pop(),b.a=c.join("_"))}c=String(a.getAttribute("type"));"checkbox"===c?b.v=!0:"hidden"===c?b.h=!0:"select"===b.B&&"select-multiple"===a.type&&(b.P=!0);b.O=null!==a.getAttribute("disabled");b.M()&&(b.u=!1)},da:function(){if("captcha"===a.getAttribute("data-type")){var c=String(a.getAttribute("id")).split("_");c.shift();c=c.join("_")}else c=a.getAttribute("name");return c},ma:function(){if(!b.h&&!b.F){var c=document.querySelector("#"+b.a+"_spinner");null!==c&&c.classList.remove("formvalidate_hidden")}},ea:function(){var c=document.querySelector("#"+b.a+"_spinner");null!==c&&c.classList.add("formvalidate_hidden")},ca:function(){return String(a.getAttribute("id"))},s:function(){return b.v?a.checked?"on":"":a.value},K:function(){b.u=!1},M:function(){if(b.h)return!1;var c=document.querySelector("."+b.a+"_error");return null!==c&&"none"!==c.style.display?!0:!1},V:function(c,g){b.h||(!0===g&&(b.u=!1),!1===b.u&&(document.querySelector("."+b.a+"_error .error_msg").appendChild(document.createTextNode(c)),c=document.querySelector("."+b.a+"_error"),c.style.display="tr"===String(c.tagName.toLowerCase())?"table-row":"block",c=document.querySelector("."+b.a+"_label"),null!==c&&c.classList.add("formvalidate_error")))},o:function(){if(!b.h){for(var c=document.querySelector("."+b.a+"_error .error_msg");null!==c.firstChild;)c.removeChild(c.firstChild);document.querySelector("."+b.a+"_error").style.display="none";c=document.querySelector("."+b.a+"_label");null!==c&&c.classList.remove("formvalidate_error")}}};b.D();return b}
 
Last edited:

Mark Miller

2Captcha Engineer
Staff member
I tried:
__grecaptcha_cfg.clients[0].$.$.callback()
__grecaptcha_cfg.clients[0].$.$.recaptchaCallback()
__grecaptcha_cfg.clients[0].$.$.callback.recaptchaCallback()
Everything "is not a function". I don't know what I'm doing wrong.

View attachment 54

This is when I put recaptchaCallback in console

View attachment 55

And this is just endless if I try to go down the tree. If I click the button next to the g() it goes to this function

In your case it is just:
recaptchaCallback('TOKEN')
 

ankurpandeyvns

New member
I'm trying to figure out recaptcha callback for kijiji.ca but can't find it. This is how the object looks
 

Attachments

  • Screenshot 2020-07-11 at 6.07.25 PM.png
    Screenshot 2020-07-11 at 6.07.25 PM.png
    54.6 KB · Views: 103

Mark Miller

2Captcha Engineer
Staff member
I'm trying to figure out recaptcha callback for kijiji.ca but can't find it. This is how the object looks
They store dashed function name there and that's a bit illegal in JS, but you can always access it from window object:
window[___grecaptcha_cfg.clients[0].B.B.callback]
and call the function this way:
window[___grecaptcha_cfg.clients[0].B.B.callback]('TOKEN')
 

ankurpandeyvns

New member
They store dashed function name there and that's a bit illegal in JS, but you can always access it from window object:
window[___grecaptcha_cfg.clients[0].B.B.callback]
and call the function this way:
window[___grecaptcha_cfg.clients[0].B.B.callback]('TOKEN')
THANKS A LOT! :)
 

mianarslan78

New member
Hey mark, when I submit "_grecaptcha.data-callback("Solved Code")" . I got this error which means its not a callback function , then can you help

me to sort out this.
1595013245268.png
 

Mark Miller

2Captcha Engineer
Staff member
Hey mark, when I submit "_grecaptcha.data-callback("Solved Code")" . I got this error which means its not a callback function , then can you help

me to sort out this.View attachment 61

_grecaptcha.data-callback is an illegal function name in javascript as it is not allowed to use dash symbol in function name, that's hy you receive the error.
But you can always access any illegally named function from window object:
window["_grecaptcha.data-callback"]("TOKEN")
 

martinezz

New member
Hello I try to solve similar problem, but when I run it like this
JavaScript:
window["__grecaptcha_cfg.clients[0].X.X.callback"]("captcharesponse");
I get TypeError: window['__grecaptcha_cfg.clients[0].X.X.callback'] is not a function

this
JavaScript:
___grecaptcha_cfg.clients[0].X.X.callback("captcharesponse")
works for me in console, but unfortunately does not work for me in ubot in which I create my bot.
 

Mark Miller

2Captcha Engineer
Staff member
Hello I try to solve similar problem, but when I run it like this
JavaScript:
window["__grecaptcha_cfg.clients[0].X.X.callback"]("captcharesponse");
I get TypeError: window['__grecaptcha_cfg.clients[0].X.X.callback'] is not a function
I think that is not applicable for your case, as this approach is used when the function name is stored in the callback property and that's a rare case.

this
JavaScript:
___grecaptcha_cfg.clients[0].X.X.callback("captcharesponse")
works for me in console, but unfortunately does not work for me in ubot in which I create my bot.
If it works in the console, then it's a proper way to execute the callback.

Unfortunately I can't help you with Ubot as I never use such kind of software, I would recommend to start from https://wiki.ubotstudio.com/wiki/Run_Javascript and ask for help in http://network.ubotstudio.com/forum/
 

agmeadows

New member
I know this thread is a little on the old side but it seems to have the most relevant information for ReCaptcha v2 callback functions. I am running into odd behavior. The call back function is called handleCaptcha. When I perform:

JavaScript:
handleCaptcha("recaptcha_answer")

In the console window the captcha is solved and everything works. I have noticed I can execute this callback without modifying the ReCaptcha text area and it still validates. When I run this command from Selenium:

Python:
log.info("Submitting Captcha")
self.driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '{0}';".format(
     recaptcha_answer))

callback_method = self.driver.find_element_by_class_name("g-recaptcha").get_attribute("data-callback")

log.info("Executing Callback")
self.driver.execute_script("{0}(\"{1}\");".format(
     callback_method, recaptcha_answer))

The page refreshes and I get a warning in the console that says:
1606101363699.png

The above code may not be correct I have monitored the process through breakpoints and it seems to be functioning the same. I event tried taking out the line that adds the g-recaptcha-response text and it still doesn't work.

Any ideas on how to get around this problem? It seems like the site is detecting the script execution from Python. Here is a link to the captcha:
https://www.walmart.com/blocked?url...&vid=b2dbe524-2b88-11eb-a61b-0242ac12000f&g=a
 
Last edited:

micuka13x

New member
I know this thread is a little on the old side but it seems to have the most relevant information for ReCaptcha v2 callback functions. I am running into odd behavior. The call back function is called handleCaptcha. When I perform:

JavaScript:
handleCaptcha("recaptcha_answer")

In the console window the captcha is solved and everything works. I have noticed I can execute this callback without modifying the ReCaptcha text area and it still validates. When I run this command from Selenium:

Python:
log.info("Submitting Captcha")
self.driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '{0}';".format(
     recaptcha_answer))

callback_method = self.driver.find_element_by_class_name("g-recaptcha").get_attribute("data-callback")

log.info("Executing Callback")
self.driver.execute_script("{0}(\"{1}\");".format(
     callback_method, recaptcha_answer))

The page refreshes and I get a warning in the console that says:
View attachment 136
The above code may not be correct I have monitored the process through breakpoints and it seems to be functioning the same. I event tried taking out the line that adds the g-recaptcha-response text and it still doesn't work.

Any ideas on how to get around this problem? It seems like the site is detecting the script execution from Python. Here is a link to the captcha:
https://www.walmart.com/blocked?url...&vid=b2dbe524-2b88-11eb-a61b-0242ac12000f&g=a

I am having the same issue. The handleCaptcha with token when sent from the dev console is working, but from Python code it is not.
Did you manage to solve this problem?
 

etuannv

New member
Hi Marcus Philips,

Your post is very useful. I studied much.

I am trying to resolve recaptcha on website Walmart.com. We have a callback function but I fail to bypass it. (see attach img)
Could you pls take a look?

Thanks.
 

Attachments

  • walmart-recaptcha.png
    walmart-recaptcha.png
    163.2 KB · Views: 46

etuannv

New member
I know this thread is a little on the old side but it seems to have the most relevant information for ReCaptcha v2 callback functions. I am running into odd behavior. The call back function is called handleCaptcha. When I perform:

JavaScript:
handleCaptcha("recaptcha_answer")

In the console window the captcha is solved and everything works. I have noticed I can execute this callback without modifying the ReCaptcha text area and it still validates. When I run this command from Selenium:

Python:
log.info("Submitting Captcha")
self.driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '{0}';".format(
     recaptcha_answer))

callback_method = self.driver.find_element_by_class_name("g-recaptcha").get_attribute("data-callback")

log.info("Executing Callback")
self.driver.execute_script("{0}(\"{1}\");".format(
     callback_method, recaptcha_answer))

The page refreshes and I get a warning in the console that says:
View attachment 136
The above code may not be correct I have monitored the process through breakpoints and it seems to be functioning the same. I event tried taking out the line that adds the g-recaptcha-response text and it still doesn't work.

Any ideas on how to get around this problem? It seems like the site is detecting the script execution from Python. Here is a link to the captcha:
https://www.walmart.com/blocked?url...&vid=b2dbe524-2b88-11eb-a61b-0242ac12000f&g=a




I found a solution. I insert a button to the webpage then click on the button to execute function handleCaptcha
 

Attachments

  • handleCaptchaWalmart.png
    handleCaptchaWalmart.png
    105.8 KB · Views: 74

Alireza

New member
Dear Mark Miller
Thanks for your all replies. They helped me a lot. But I encounter a different problem. I wanna bypass a hCaptcha by 2captcha service. According to the 2captcha official web site, after solving hCaptcha and receive its response, I have to find two web elements that their IDs are "h-captcha-response" and "g-recaptcha-response". I have set the response for these two web elements and then I have to find and call a callback function. But instead, to find a "callBack " I found a "promise-callback". Honestly, I don't know how could I execute it?
 

Attachments

  • Capture.PNG
    Capture.PNG
    25 KB · Views: 46