Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A piece of javascript code that can help you to find reCAPTCHA parameters
// IMPORTANT! PLEASE READ BEFORE USING THIS:
//
// 1. This is JavaScript. JavaScript is executed in a browser.
// You can execute javascript when you control a browser with some browser automation tools.
// To execute javascript from your code use the corresponding method provided by your tool, for example:
// JavascriptExecutor interface in Selenium Java
// ExecuteJavaScript method of WebDriver in Selenium for .Net
// page.evaluate method in puppeteer
// Please refer to docs of your favourite browser automation tool for more info
//
// 2. If you don't understand what UNDEFINED means in the javascript console, please read:
// When you execute the code in the javascript console of your browser, the console evaluates EACH expression
// and prints the returned value. And if your expression does not return any value (that is absolutely normal)
// then you see 'undefined' in the console. This is NOT AND ERROR!
//
// For better understanding type the following in the console:
// let myVar = 'foo' // defines myVar variable and sets it's value to 'foo'
// You will see undefined in the console as this exression does not return anything.
//
// Then type the following
// (() => 'bar')() // defines and calls a function that returns 'bar'
// You will see "bar" as the function returns this value
//
// And one more case. Type:
// ((a) => { b = a * 2 })(2) // defines and calls a function that does not return any value
// What you will see? Yep, you will see undefined
//
// Hope now you understand some javascript console basics :)
//
// 3. The callback can be not the final step in your process. That is fine when after the callback you also need to perform
// another action like button click, form submission, etc
//
// 4. NO, we can't make the same script for hCaptcha as the callback is not defined inside globaly accessible variables.
// USAGE
// paste the function definition into the console and then call the function:
//
// let res = findRecaptchaClients()
// console.log(res)
//
// the function returns an array of objects with recaptcha parameters for each implementation found on the page
function findRecaptchaClients() {
// eslint-disable-next-line camelcase
if (typeof (___grecaptcha_cfg) !== 'undefined') {
// eslint-disable-next-line camelcase, no-undef
return Object.entries(___grecaptcha_cfg.clients).map(([cid, client]) => {
const data = { id: cid, version: cid >= 10000 ? 'V3' : 'V2' };
const objects = Object.entries(client).filter(([_, value]) => value && typeof value === 'object');
objects.forEach(([toplevelKey, toplevel]) => {
const found = Object.entries(toplevel).find(([_, value]) => (
value && typeof value === 'object' && 'sitekey' in value && 'size' in value
));
if (typeof toplevel === 'object' && toplevel instanceof HTMLElement && toplevel['tagName'] === 'DIV'){
data.pageurl = toplevel.baseURI;
}
if (found) {
const [sublevelKey, sublevel] = found;
data.sitekey = sublevel.sitekey;
const callbackKey = data.version === 'V2' ? 'callback' : 'promise-callback';
const callback = sublevel[callbackKey];
if (!callback) {
data.callback = null;
data.function = null;
} else {
data.function = callback;
const keys = [cid, toplevelKey, sublevelKey, callbackKey].map((key) => `['${key}']`).join('');
data.callback = `___grecaptcha_cfg.clients${keys}`;
}
}
});
return data;
});
}
return [];
}
@khaelou

This comment has been minimized.

Copy link

@khaelou khaelou commented Jun 12, 2020

Thanks, much appreciated 👍

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Oct 28, 2020

When this script is run in the console (Chrome - Dev Tools) it returns undefined. Is it still working?

@khaelou

This comment has been minimized.

Copy link

@khaelou khaelou commented Oct 29, 2020

@hdsouza try using "___grecaptcha_cfg.clients[0]" in console to find the captcha

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Oct 29, 2020

Thanks @khaelou.

Yes, I opened the site in Firefox and did an inspect element
In the console if I type "___grecaptcha_cfg.clients". I see 2 clients. Which one do i select? 0 or 100000

image

If I select 0 then.. Is this the correct path.. "___grecaptcha_cfg.clients[0].A.A." ..or do i need to go into some of the other letters below, like G, N etc. I was going with A.A as I see that it has the same sitekey value as I would need to use when I would request for the captcha response.

image

@khaelou

This comment has been minimized.

Copy link

@khaelou khaelou commented Oct 29, 2020

@hdsouza Yes always use ___grecaptcha_cfg.clients[0], from previous experience please remember that the Object letter may change over time. For example ___grecaptcha_cfg.clients[0].A.sitekey may become ___grecaptcha_cfg.clients[0].K.sitekey another day. So again, it'll always be the object which contains the sitekey.

@kratzky

This comment has been minimized.

Copy link

@kratzky kratzky commented Nov 2, 2020

Thanks @khaelou.

Yes, I opened the site in Firefox and did an inspect element
In the console if I type "___grecaptcha_cfg.clients". I see 2 clients. Which one do i select? 0 or 100000

image

If I select 0 then.. Is this the correct path.. "___grecaptcha_cfg.clients[0].A.A." ..or do i need to go into some of the other letters below, like G, N etc. I was going with A.A as I see that it has the same sitekey value as I would need to use when I would request for the captcha response.

image

In most cases:
[0] is V2/V2 invisible
[100000] is V3

and even in really rare cases there are multiple implementations of each version with indexes like [1], [2] or [100001], [100002]

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Nov 2, 2020

So what should the call back in this case: "___grecaptcha_cfg.clients[0].A.A.callback(CapthcaResponse) ?

@khaelou

This comment has been minimized.

Copy link

@khaelou khaelou commented Nov 2, 2020

@hdsouza ___grecaptcha_cfg.clients[0].A.A.callback(CapthcaResponse) is correct way to call callback in your case

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Nov 3, 2020

@khaelou I have tried that command from Firefox - devtools - console and it does not send the response across. There is no activity on page to signify that the command did anything. Do I need to specify the name of the callback function "bound " somehow?

@khaelou

This comment has been minimized.

Copy link

@khaelou khaelou commented Nov 3, 2020

@hdsouza That's odd, yet I'm not sure about Firefox since I've been using Chrome. Try running from Chrome Dev Tools Console and see if that makes a difference. The name of callback or what goes in the '' of the callback() function is the solved token key that is generated from 2captcha.com

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Nov 6, 2020

Thanks @khaelou . I just realized it was working all along. The callback command was being sent correctly but I was looking for a check-mark of captcha acceptance which I was not seeing, but when I just tried clicking on the login button, it went right through. Thanks for prodding me in the right direction :) .. That being said, is there a command that will validate that the captcha has been accepted.. something like grecaptcha.getResponse (I realize its not relevant to the main topic).

@khaelou

This comment has been minimized.

Copy link

@khaelou khaelou commented Nov 16, 2020

@hdsouza Yes, yet it isn't exactly a command. You should refer to the documentation of your provided captcha solving service (2captcha) which usually provide endpoints for verification/error-handling.

@Kukunin

This comment has been minimized.

Copy link

@Kukunin Kukunin commented Jan 13, 2021

Thank you for the code. I modified it to avoid evals:

function findRecaptchaClients() {
  // eslint-disable-next-line camelcase
  if (typeof (___grecaptcha_cfg) !== 'undefined') {
    // eslint-disable-next-line camelcase, no-undef
    return Object.entries(___grecaptcha_cfg.clients).map(([cid, client]) => {
      const data = { id: cid, version: cid >= 10000 ? 'V3' : 'V2' };
      const objects = Object.entries(client).filter(([_, value]) => value && typeof value === 'object');

      objects.forEach(([toplevelKey, toplevel]) => {
        const found = Object.entries(toplevel).find(([_, value]) => (
          value && typeof value === 'object' && 'sitekey' in value && 'size' in value
        ));
        if (found) {
          const [sublevelKey, sublevel] = found;

          data.sitekey = sublevel.sitekey;
          const callbackKey = data.version === 'V2' ? 'callback' : 'promise-callback';
          const callback = sublevel[callbackKey];
          if (!callback) {
            data.callback = null;
            data.function = null;
          } else {
            data.function = callback;
            const keys = [cid, toplevelKey, sublevelKey, callbackKey].map((key) => `['${key}']`).join('');
            data.callback = `___grecaptcha_cfg.clients${keys}`;
          }
        }
      });
      return data;
    });
  }
  return [];
}
@2captcha

This comment has been minimized.

Copy link
Owner Author

@2captcha 2captcha commented Jan 13, 2021

Thank you for the code. I modified it to avoid evals:

Thank you, @Kukunin!
Updated the gist to your version which is really good.

@adreesm102

This comment has been minimized.

Copy link

@adreesm102 adreesm102 commented Jan 16, 2021

Hi here is my website https://web.sbcounty.gov/sheriff/bookingsearch/bookingsearch.aspx after submit booking number 2101340001 I will get a callback Recaptcha. I tried a lot to call that Recaptcha but unfortunately unsuccessful. I have not got anything in inspect>console after typing the command. can you please help how can I call that callback function. I am doing it using node js

@2captcha

This comment has been minimized.

Copy link
Owner Author

@2captcha 2captcha commented Jan 16, 2021

Hi here is my website https://web.sbcounty.gov/sheriff/bookingsearch/bookingsearch.aspx after submit booking number 2101340001 I will get a callback Recaptcha. I tried a lot to call that Recaptcha but unfortunately unsuccessful. I have not got anything in inspect>console after typing the command. can you please help how can I call that callback function. I am doing it using node js

@adreesm102 looks like you are not following the instruction from the comment

screenshot

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Jan 16, 2021

@adreesm102 Try the commands in JavaScript one line at a time and identify on which line the errors occurs.

@adreesm102

This comment has been minimized.

Copy link

@adreesm102 adreesm102 commented Jan 16, 2021

@2captcha thanks its clear. Now I am facing the issue that I got the response from 2captcha but when I execute the callback ___grecaptcha_cfg.clients[0].P.P.callback('${response}') It does not work. I want to render the page to next when Recaptcha is resolved.So can u help me in that way. I am using Node Js puppeteer

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Jan 16, 2021

Your ___grecaptcha_cfg.clients[0].P.P.callback is correct. I believe the RESPONSE is also correct, but the problem doing it this way is that the page will not tell you that the CAPTCHA has been accepted or not. The page needs an OK button to click on, on the page,
So after you have executed the script, you click on the OK button and that should take it.
Since there is no OK button on the page, that will pose a problem.

You can try to add an OK button to the page via script... as in this video https://www.youtube.com/watch?v=zOmhDxRqX18 -- @3:34 .
Then execute the callback and click on the OK button.
Not sure if this is even possible, but you can try.

@adreesm102

This comment has been minimized.

Copy link

@adreesm102 adreesm102 commented Jan 16, 2021

Thanks, @hdsouza but it not work.

@adreesm102

This comment has been minimized.

Copy link

@adreesm102 adreesm102 commented Jan 17, 2021

(https://user-images.githubusercontent.com/70963992/104833483-b8a64d80-58ba-11eb-9872-3cf8e5381f96.JPG)
can you please guid me Is I am calling right callback
driver.execute('___grecaptcha_cfg.clients[0].P.P.callback({})'.format(token))

@hdsouza

This comment has been minimized.

Copy link

@hdsouza hdsouza commented Jan 17, 2021

Try using webmaster tools with the google browser.
With that, the command I use is
const CapthcaResponse = "CAPTCHA_RESPONSE_RECEIVED";
___grecaptcha_cfg.clients[0].P.P.callback(CapthcaResponse);

@weiitezhu

This comment has been minimized.

Copy link

@weiitezhu weiitezhu commented Jan 18, 2021

I couldn't find the last callback function I needed
image
image

@weiitezhu

This comment has been minimized.

Copy link

@weiitezhu weiitezhu commented Jan 18, 2021

I found a possible one but it always gets an error when I call it
image
image

@Vyprath

This comment has been minimized.

Copy link

@Vyprath Vyprath commented Jan 18, 2021

image
https://account.oneplus.com/signin/

I cannot for the life of me find any callback functions in the code. Is there any?

@2captcha

This comment has been minimized.

Copy link
Owner Author

@2captcha 2captcha commented Jan 18, 2021

@Vyprath

This comment has been minimized.

Copy link

@Vyprath Vyprath commented Jan 18, 2021

@Vyprath
image

    result = solver.recaptcha(
        sitekey='6LcXjQcUAAAAANKDft8a25E8PRogqCPKENK2LCnv', url=driver.current_url)
    TOKEN_FROM_2CAPTCHA = result['code']
    driver.execute_script(
        f'document.getElementById("g-recaptcha-response").innerHTML="{TOKEN_FROM_2CAPTCHA}";')
    print("Executed driver script:")
    driver.execute_script(
        "___grecaptcha_cfg.clients['0']['P']['P']['callback'];"
    )

    print("Submitted function")

This is how I am doing it but it still isn't solving the captcha in my screen atleast.
image

@2captcha

This comment has been minimized.

Copy link
Owner Author

@2captcha 2captcha commented Jan 18, 2021

@weiitezhu

I found a possible one but it always gets an error when I call it

You found a wrong one.
And at least there's no callback defined inside grecaptcha.render so if the captcha is rendered from the code you found then there's no callback.
Please read the recaptcha docs to find how the callback can be defined if you are not able to use the script from the gist for some reason. And keep in mind that callback is optional.

@2captcha

This comment has been minimized.

Copy link
Owner Author

@2captcha 2captcha commented Jan 18, 2021

@Vyprath

    result = solver.recaptcha(
        sitekey='6LcXjQcUAAAAANKDft8a25E8PRogqCPKENK2LCnv', url=driver.current_url)
    TOKEN_FROM_2CAPTCHA = result['code']
    driver.execute_script(
        f'document.getElementById("g-recaptcha-response").innerHTML="{TOKEN_FROM_2CAPTCHA}";')
    print("Executed driver script:")
    driver.execute_script(
        "___grecaptcha_cfg.clients['0']['P']['P']['callback'];"
    )

    print("Submitted function")

This is how I am doing it but it still isn't solving the captcha in my screen atleast.

Try to do everything in the browser console and only then try to repeat the same with Selenium or any other automation tool. That's the first rule everyone should follow.

And yep, your call here is incorrect:

 driver.execute_script(
        "___grecaptcha_cfg.clients['0']['P']['P']['callback'];"
    )

To call a function in JavaScript you must add brackets. It is made like this:

myFunctionName(argument)
myObject.function(arg1, arg2)

Please learn some JavaScript basics if you are going to deal with web automation 😄

@Vyprath

This comment has been minimized.

Copy link

@Vyprath Vyprath commented Jan 18, 2021

Please learn some JavaScript basics if you are going to deal with web automation 😄

For some reason I didn't think that was a function call. Extremely sorry. Everything works now! Thank you 2captcha!

@chwba

This comment has been minimized.

Copy link

@chwba chwba commented Jan 18, 2021

Question: For this website: https://cracked.to/member.php?action=login I paste captcha solution in: 'document.getElementById("g-recaptcha-response").innerHTML = solution like so. When I click Login it asks me to solve the captcha again, can you hint me how to properly submit the solution? (Using the script there is no callback function found)

image

@adreesm102

This comment has been minimized.

Copy link

@adreesm102 adreesm102 commented Jan 18, 2021

@Vyprath

This comment has been minimized.

Copy link

@Vyprath Vyprath commented Jan 18, 2021

Can you please share detail how you solved callback function

On Mon, Jan 18, 2021, 6:41 PM Pranav @.***> wrote: @Vyprath commented on this gist. ------------------------------ Please learn some JavaScript basics if you are going to deal with web automation 😄 For some reason I didn't think that was a function call. Extremely sorry. Everything works now! Thank you 2captcha! — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://gist.github.com/2ee70fa1130e756e1693a5d4be4d8c70#gistcomment-3597959, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ5NGGFZSKTC7SRO7ZISVC3S2Q3BZANCNFSM4N34BUWQ .

I still haven't fully figured it out myself too. I just added () to the end. But I am facing an error ("Captcha Invalid"). Although I think it is because my IP is now flagged.

@chwba

This comment has been minimized.

Copy link

@chwba chwba commented Jan 18, 2021

Question: For this website: https://cracked.to/member.php?action=login I paste captcha solution in: 'document.getElementById("g-recaptcha-response").innerHTML = solution like so. When I click Login it asks me to solve the captcha again, can you hint me how to properly submit the solution? (Using the script there is no callback function found)

image

Anyone got an idea?

@kratzky

This comment has been minimized.

Copy link

@kratzky kratzky commented Jan 18, 2021

@chwba
Try this:

document.querySelector('#g-recaptcha-response').innerText='token_string_here'
document['getElementsByClassName']('member-full')[0]['submit']()
@chwba

This comment has been minimized.

Copy link

@chwba chwba commented Jan 18, 2021

document['getElementsByClassName']('member-full')[0]['submit']()

Nice, that actually pulled it off, how did you find that out? Is there something one could add to the script to figure out this kind of submitting?

Because on https://www.epicnpc.com after clicking "Log in", there is a captcha as well and there this method doesnt work, it fails with:
Uncaught TypeError: document.getElementsByClassName(...)[0] is undefined

Note: Previously I had been using this plugin: https://antcpt.com/eng/download/mozilla-firefox.html which was able to do it perfectly on any website, one with good practise in js could probably rip out the required functions, they use for parsing out the submission information but I am only a python developer :)

@kratzky

This comment has been minimized.

Copy link

@kratzky kratzky commented Jan 18, 2021

@chwba just looking on the button's click event listeners
image

And of course it is applicable only to cracked.to.

@adreesm102

This comment has been minimized.

Copy link

@adreesm102 adreesm102 commented Jan 18, 2021

I am resolving Recaptcha for this website. When I enetered booking # 2101340001 I will get recpatcha. I resolved it successfully but when I resolved it manually It render the page next automatically by calling callback function but It is not happen with 2 captcha
recaptcha

@kratzky can you please check and help me.

.

@adreesm102

This comment has been minimized.

@kratzky

This comment has been minimized.

Copy link

@kratzky kratzky commented Jan 18, 2021

https://web.sbcounty.gov/sheriff/bookingsearch/bookingsearch.aspx this is the web URL

didn't tested on my end, but try the following:

  1. Redefine getBooking changing the part where it gets the captcha token:
getBooking = function(token) {

    var mdl = new InmateLocator.mdlInmateStatus;
    mdl.BookNo = document.getElementById("txtBookNo").value; // row.getAttribute("key0");
    mdl.CaptchaResponse = token;
    document.getElementById("spnResults").style.display = "none";
    document.getElementById("divStatus").style.display = "none";
    document.getElementById("divSearch").style.display = "none";
    document.getElementById("spnStatusMessage").innerHTML = "Getting Booking Information ..."
    document.getElementById("spnStatusMessage").style.display = "";
    document.getElementById("spnSearchAgain").style.display = "none";
    document.getElementById("celBooking").innerHTML = mdl.BookNo;
    PageMethods.GetInmateStatus(mdl, displayBooking, displayError, displayTimeout);
    
}
  1. Fill the form with your booking reference
  2. Execute getBooking passing the token into the function argument:
getBooking('captcha_token_string');

Inside getBooking they get the token directly from grecaptcha.getResponse(); call.
In some cases if you can not redefine the parent function you can redefine grecaptcha.getResponse() like:
grecaptcha.getResponse = () => 'captcha_token_string'

@chwba

This comment has been minimized.

Copy link

@chwba chwba commented Jan 18, 2021

@chwba just looking on the button's click event listeners
image

And of course it is applicable only to cracked.to.

Nice, yeah makes sense, I wonder how that plugin of anticaptcha does it because this one seems to literally work anywhere but since I moved away from selenium I cant use plugins anymore and am now on it to implement it all on my own. - If that plugin can do it anywhere, it should be possible to create a generic solution for the submission problem though.

@Doctuh

This comment has been minimized.

Copy link

@Doctuh Doctuh commented Jan 18, 2021

Hey I am trying to complete a captcha using 2captcha. I get the response code back from 2captcha, which is the response they give up solving the captcha. I inject this token into the innerHtml of the hidden field, which is at id="g-recaptcha-response". This all works flawlessly and I confirmed it by checking the innerHtml to see if the token got injected there, it did.

Now I am trying to execute the callback function, which in my case is at:
___grecaptcha_cfg.clients[0].P.P.callback("Here I provide my token for the solved captcha") I execute this javascript code, on the given captcha page.

However this last step returns to me the following error code:

GET https://geo.captcha-delivery.com/captcha/check?cid=84YTH2O0F.uzeP0Fhm-LTGpltPzojt.Jh1phd7GG6Qi.uCL2rd4Z-LiQWxcVF-Fxw6zzXw9-INkdQrYqZEx8kX-~5qHqyT1Nidsux6Yhl5&icid=AHrlqAAAAAMAeRI5aB3ef_YAk04eUg%3D%3D&ccid=null&g-recaptcha-response=03AGdBq26LUVR7GP5vi8hG3FbHu5tmD1DFNuPU6zLne0eeOstvTttQcruZvy-h15ClYoCG7bxangmf0L71qBo3Rx7QdrujpMwlZsroBNL-bVcVeuEN0WjEyotO6RtD2r-Ly8gPLYhj0Ha2wRcP0uiArvQFZGqOIPGXjxnaK2135OiOT7rmbgrtjxnBZEQ6pvKgQxxo-9nFGVsTMODK86a2Zik8rk-Zi_O7tll8uvLnWiiY8yqlwVcJMc1bDDJZK9PE9lvcYJq32Scfpq1dPHZ9ANBpIx_6eQaQYfvWSWtoTuIdW7X9Tko9FTXsAur6zFAlVsNCTJJe6SeeFLvLc4CF27Zv8x3zLDemz8k1nq_UGXV6ApnhzCkfu9imvpRrfTtG5RrScMkMH5pjr6P9SW8ec-vRL4EVCVrw2Vgxmy9scBcryEJEZl6mhrKeAEAB7RYyT-L6g70spFJHyYLNa2ioLBZyRHsSiUQqPnkTj4BP0kl_X3NXpbGnGtQ0CvVCMLWqxEqWnhMvct4R-XRTYsHGAYly8KX4RdRGrqjwF2ZmamwJI2G0psHbBQs&hash=A55FBF4311ED6F1BF9911EB71931D5&ua=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F87.0.4280.141%20Safari%2F537.36&referer=https%3A%2F%2Fwww.footlocker.dk%2Fen%2Fproduct%2Fnike-air-force-1-low-menshoes%2F314102199404.html&parent_url=https%3A%2F%2Fwww.footlocker.dk%2Fen%2Fproduct%2Fnike-air-force-1-low-menshoes%2F314102199404.html&x-forwarded-for=&captchaChallenge=179113579&s=17434 403 (Forbidden)

If someone would mind helping me out? :S
my discord is: doc#5244 (for faster communication if wanted :))

Regards!

@Doctuh

This comment has been minimized.

Copy link

@Doctuh Doctuh commented Jan 18, 2021

Never mind I fixed it, it was wrong token I put into request, awesome!

@chwba

This comment has been minimized.

Copy link

@chwba chwba commented Jan 19, 2021

Any js dev maybe got an idea how to strip out the mechanics from https://antcpt.com/eng/download/mozilla-firefox.html or https://antcpt.com/eng/download/google-chrome-options.html to create a generic solution for the various different captcha submission mechanics, which are hard to figure out for non-js devs? Having a hard time to figure it out for the other various targets (20+)..

@Vyprath

This comment has been minimized.

Copy link

@Vyprath Vyprath commented Jan 23, 2021

Hey, after I do the captcha callback, I get this error.
image

result = solver.recaptcha(sitekey='6LcXjQcUAAAAANKDft8a25E8PRogqCPKENK2LCnv', url=driver.current_url)
TOKEN_FROM_2CAPTCHA = result['code']

driver.execute_script(
    f'document.getElementById("g-recaptcha-response").innerHTML="{TOKEN_FROM_2CAPTCHA}";')
print("Executed driver script:")
sleep(2)
driver.execute_script(
    f"___grecaptcha_cfg.clients['0']['P']['P']['callback']({TOKEN_FROM_2CAPTCHA});"
)

The issue persists when I am trying to log in to the OnePlus website.
I've tried running the code line-by-line on my browser and still nothing seems to work. Am I passing the wrong token to the callback function? I cannot tell. Website URL: https://account.oneplus.com/signin/

@Oleh-Hrebchuk

This comment has been minimized.

Copy link

@Oleh-Hrebchuk Oleh-Hrebchuk commented Jan 25, 2021

import time

import requests
from selenium import webdriver


API_2CAPTCHA = 'your key'
URL_POST_CAPTCHA = 'http://2captcha.com/in.php'
URL_GET_CAPTCHA = 'http://2captcha.com/res.php'


def resolve_captcha(blocked_url):
    options = webdriver.ChromeOptions()
    user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'
    options.add_argument('user-agent={0}'.format(user_agent))

    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")
    driver = webdriver.Chrome(chrome_options=options)
    driver.execute_script("return navigator.userAgent")
    for x in range(10):
        if x == 0:
            driver.get(blocked_url)
            time.sleep(5)

        data_site_key = driver.find_element_by_css_selector('.g-recaptcha').get_attribute('data-sitekey')

        response = requests.get(
            'http://2captcha.com/in.php?key={key}&method=userrecaptcha'
            '&googlekey={data_sitekey}&pageurl={site_url}?appear=1&here=now'.
                format(
                key=API_2CAPTCHA,
                data_sitekey=data_site_key,
                site_url=blocked_url
            )
        )
        timeout = 8
        resolved = False
        for i in range(8):
            time.sleep(timeout)
            timeout += 8

            id_message = response.text.split('|')[-1]
            resolved_captcha = requests.get(
                '{}?key={}&action=get&id={}'.format(
                    URL_GET_CAPTCHA,
                    API_2CAPTCHA,
                    id_message
                )
            )
            resolved_token = resolved_captcha.text.split('|')

            if resolved_token[0] == 'OK':
                resolved = resolved_token[-1]
                print(resolved)
                break

        res = f'handleCaptcha("{resolved}")'
        driver.execute_script(res)

        if driver.current_url != blocked_url:
            break

resolve_captcha('https://www.walmart.com/blocked?url=L2dyb2NlcnkvdjQvYXBpL3Byb2R1Y3RzL3NlYXJjaD9jb3VudD02MCZmaWx0ZXI9Z2hzX2JyYW5kflNpZXRlJTIwRmFtaWx5JTIwRm9vZHMmb2Zmc2V0PTAmcGFnZT0xJnN0b3JlSWQ9NjE3MyZxdWVyeT1zaWV0ZSZzcGVsbGluZz1mYWxzZQ==&uuid=d2bc9a70-5efb-11eb-a179-af3690198cb9&vid=d54095e8-5efb-11eb-9695-0242ac12000e&g=a')

it's not working via Python, but when insert solved key in Chrome console it's works, please help me.
handleCaptcha("resolved")

@kratzky

This comment has been minimized.

Copy link

@kratzky kratzky commented Jan 25, 2021

@arielo82

I executed the code of beggining, but callback is null.

null significa que no hay callback
pon el token en g-recaptcha-response y haz click en el boton Consultar

@arielo82

This comment has been minimized.

Copy link

@arielo82 arielo82 commented Jan 25, 2021

Gracias kratzky!

@dellyet

This comment has been minimized.

Copy link

@dellyet dellyet commented Jan 29, 2021

Hi,

when I run this Script a get an output:

Screenshot

I call this function in my Code:

IJavaScriptExecutor e = driver;
e.ExecuteScript("___grecaptcha_cfg.clients[0].o.o.callback('{" + captcha + "}')");

It ends up with no exception but anyway with no submitting the login.

When i try to fire the command from Browser:

___grecaptcha_cfg.clients[0].o.o.callback('{2CaptchaResponse}')

I get the error "undefined".

After hours of searching, I don't know what to do next. Can someone help me please?

Thanks a lot!

@nhordez

This comment has been minimized.

Copy link

@nhordez nhordez commented Jan 31, 2021

import time

import requests
from selenium import webdriver


API_2CAPTCHA = 'your key'
URL_POST_CAPTCHA = 'http://2captcha.com/in.php'
URL_GET_CAPTCHA = 'http://2captcha.com/res.php'


def resolve_captcha(blocked_url):
    options = webdriver.ChromeOptions()
    user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'
    options.add_argument('user-agent={0}'.format(user_agent))

    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")
    driver = webdriver.Chrome(chrome_options=options)
    driver.execute_script("return navigator.userAgent")
    for x in range(10):
        if x == 0:
            driver.get(blocked_url)
            time.sleep(5)

        data_site_key = driver.find_element_by_css_selector('.g-recaptcha').get_attribute('data-sitekey')

        response = requests.get(
            'http://2captcha.com/in.php?key={key}&method=userrecaptcha'
            '&googlekey={data_sitekey}&pageurl={site_url}?appear=1&here=now'.
                format(
                key=API_2CAPTCHA,
                data_sitekey=data_site_key,
                site_url=blocked_url
            )
        )
        timeout = 8
        resolved = False
        for i in range(8):
            time.sleep(timeout)
            timeout += 8

            id_message = response.text.split('|')[-1]
            resolved_captcha = requests.get(
                '{}?key={}&action=get&id={}'.format(
                    URL_GET_CAPTCHA,
                    API_2CAPTCHA,
                    id_message
                )
            )
            resolved_token = resolved_captcha.text.split('|')

            if resolved_token[0] == 'OK':
                resolved = resolved_token[-1]
                print(resolved)
                break

        res = f'handleCaptcha("{resolved}")'
        driver.execute_script(res)

        if driver.current_url != blocked_url:
            break

resolve_captcha('https://www.walmart.com/blocked?url=L2dyb2NlcnkvdjQvYXBpL3Byb2R1Y3RzL3NlYXJjaD9jb3VudD02MCZmaWx0ZXI9Z2hzX2JyYW5kflNpZXRlJTIwRmFtaWx5JTIwRm9vZHMmb2Zmc2V0PTAmcGFnZT0xJnN0b3JlSWQ9NjE3MyZxdWVyeT1zaWV0ZSZzcGVsbGluZz1mYWxzZQ==&uuid=d2bc9a70-5efb-11eb-a179-af3690198cb9&vid=d54095e8-5efb-11eb-9695-0242ac12000e&g=a')

it's not working via Python, but when insert solved key in Chrome console it's works, please help me.
handleCaptcha("resolved")

Have anyone managed to solve the call with the token in the callback function? Having the same issue, from console it is working but from Python it is not?

TIA, appreciate the help.

@chwba

This comment has been minimized.

Copy link

@chwba chwba commented Jan 31, 2021

Christ this is a javascript snippet, would you stop bloating comments with full code snippets of your implementations?.... The topic is the snippet scraping captcha information about a target site and as an addition it would be nice to have it also scrape the "submit" function if there is no callback function.

Any js dev maybe got an idea how to strip out the mechanics from https://antcpt.com/eng/download/mozilla-firefox.html or https://antcpt.com/eng/download/google-chrome-options.html to create a generic solution for the various different captcha submission mechanics, which are hard to figure out for non-js devs? Having a hard time to figure it out for the other various targets (20+)..

^ would be much more interesting, as it would solve the 'submission' mechanics once and for all.

@cybernetor066

This comment has been minimized.

Copy link

@cybernetor066 cybernetor066 commented Feb 4, 2021

Hello Guys Please anyone can help me with this one?, It doesnt have a callback function. Neither does it go through, even when i hit the submit button or try to submit with JavaScript snippet. Here is the website:

https://www.presearch.org/register

After i input the code, it tells me this warning in red: "The g-recaptcha-response field is required."

Please help me. thanks in advance.

@albrechtmate

This comment has been minimized.

Copy link

@albrechtmate albrechtmate commented Feb 4, 2021

import time

import requests
from selenium import webdriver


API_2CAPTCHA = 'your key'
URL_POST_CAPTCHA = 'http://2captcha.com/in.php'
URL_GET_CAPTCHA = 'http://2captcha.com/res.php'


def resolve_captcha(blocked_url):
    options = webdriver.ChromeOptions()
    user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36'
    options.add_argument('user-agent={0}'.format(user_agent))

    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")
    driver = webdriver.Chrome(chrome_options=options)
    driver.execute_script("return navigator.userAgent")
    for x in range(10):
        if x == 0:
            driver.get(blocked_url)
            time.sleep(5)

        data_site_key = driver.find_element_by_css_selector('.g-recaptcha').get_attribute('data-sitekey')

        response = requests.get(
            'http://2captcha.com/in.php?key={key}&method=userrecaptcha'
            '&googlekey={data_sitekey}&pageurl={site_url}?appear=1&here=now'.
                format(
                key=API_2CAPTCHA,
                data_sitekey=data_site_key,
                site_url=blocked_url
            )
        )
        timeout = 8
        resolved = False
        for i in range(8):
            time.sleep(timeout)
            timeout += 8

            id_message = response.text.split('|')[-1]
            resolved_captcha = requests.get(
                '{}?key={}&action=get&id={}'.format(
                    URL_GET_CAPTCHA,
                    API_2CAPTCHA,
                    id_message
                )
            )
            resolved_token = resolved_captcha.text.split('|')

            if resolved_token[0] == 'OK':
                resolved = resolved_token[-1]
                print(resolved)
                break

        res = f'handleCaptcha("{resolved}")'
        driver.execute_script(res)

        if driver.current_url != blocked_url:
            break

resolve_captcha('https://www.walmart.com/blocked?url=L2dyb2NlcnkvdjQvYXBpL3Byb2R1Y3RzL3NlYXJjaD9jb3VudD02MCZmaWx0ZXI9Z2hzX2JyYW5kflNpZXRlJTIwRmFtaWx5JTIwRm9vZHMmb2Zmc2V0PTAmcGFnZT0xJnN0b3JlSWQ9NjE3MyZxdWVyeT1zaWV0ZSZzcGVsbGluZz1mYWxzZQ==&uuid=d2bc9a70-5efb-11eb-a179-af3690198cb9&vid=d54095e8-5efb-11eb-9695-0242ac12000e&g=a')

it's not working via Python, but when insert solved key in Chrome console it's works, please help me.
handleCaptcha("resolved")

Have anyone managed to solve the call with the token in the callback function? Having the same issue, from console it is working but from Python it is not?

TIA, appreciate the help.

Hi, I'm facing with the same problem. Did you find a solution for that? I'm using selenium with python, and i cant call the callback function.

@Oleh-Hrebchuk

This comment has been minimized.

Copy link

@Oleh-Hrebchuk Oleh-Hrebchuk commented Feb 4, 2021

@meenapriya-ui

This comment has been minimized.

Copy link

@meenapriya-ui meenapriya-ui commented Feb 26, 2021

Hi,

I'm able to retrieve / scrape the URL using the method GET and while trying to POST the request with the payload, It is saying success but form did not get submitted, I'm bit confused to call the callback function in python,form is submitted via callback function,can you please give some suggestion to call the callback function in python?

@andress134

This comment has been minimized.

Copy link

@andress134 andress134 commented Mar 2, 2021

i try with chromedriver,but some wrong
here is my code exemple (golang)

for html, _ := page.HTML(); strings.Contains(html, "___grecaptcha_cfg"); html, _ = page.HTML() {
		if pageurl, err := page.URL(); err == nil {
			answer := strings.Trim(getAnswer(pageurl, userAgent), "\n")
			page.RunScript(`document.getElementsByName("g-recaptcha-response")[0].value = \""` + answer + `"\""`, nil, nil)
			page.RunScript("document.getElementById(\"g-recaptcha\").submit()", nil, nil)```
@meenapushpa

This comment has been minimized.

Copy link

@meenapushpa meenapushpa commented Mar 2, 2021

I need to submit the data using post method,it redirect to successful page but the server didn't send mail to user.While,manually if we submit the data,user get respective mail from the server.I didn't find any mistake in my code,can you suggest some ideas?

@onlineie

This comment has been minimized.

Copy link

@onlineie onlineie commented Mar 11, 2021

how to call this function?
The console keeps returning undefined.
image

@bekowsky

This comment has been minimized.

Copy link

@bekowsky bekowsky commented Mar 11, 2021

how to call this function?
The console keeps returning undefined.
image

I have same problem. Looks like callback functions want to take another function, not string value. But idk how to do it.

@2captcha

This comment has been minimized.

Copy link
Owner Author

@2captcha 2captcha commented Mar 17, 2021

Added a huge comment into the gist.
Hope now it is more clear what is this and how to use it.

@Universes2

This comment has been minimized.

Copy link

@Universes2 Universes2 commented Mar 18, 2021

image

Have someone an Idea how to solve this Captcha? :)

@Universes2

This comment has been minimized.

Copy link

@Universes2 Universes2 commented Mar 18, 2021

I'am using autoit.

_FFCmd('.getElementById("g-recaptcha-response").removeAttribute("style");') <---- work
_FFCmd('.getElementById("g-recaptcha-response").innerHTML="' & $CaptchaAntwort & '";') <----- work
_FFCmd("content.wrappedJSObject.onRecaptchaResponse("&$CaptchaAntwort&");") <---- dont work

@GhaithAlHallak8

This comment has been minimized.

Copy link

@GhaithAlHallak8 GhaithAlHallak8 commented Apr 2, 2021

hi, where can i find hcaptcha's callback function?

@kratzky

This comment has been minimized.

Copy link

@kratzky kratzky commented Apr 2, 2021

hi, where can i find hcaptcha's callback function?

Line 33 of the gist.

@GhaithAlHallak8

This comment has been minimized.

Copy link

@GhaithAlHallak8 GhaithAlHallak8 commented Apr 2, 2021

hi, where can i find hcaptcha's callback function?

Line 33 of the gist.

i know that, i didn't ask if i could use this script for hcaptcha. i asked where/how i could find the callback function for hcaptcha.

@qinetiqu

This comment has been minimized.

Copy link

@qinetiqu qinetiqu commented Apr 13, 2021

Hi everyone. By calling ___grecaptcha_cfg.clients[0].S.S.callback() , I got Uncaught TypeError: this.updateFormValid is not a function. Where is the problem?

@jackylee53

This comment has been minimized.

Copy link

@jackylee53 jackylee53 commented Apr 14, 2021

Hi here is my website https://www.btgpactualdigital.com/digital/#!/entrar/login, I found the callback function is "___grecaptcha_cfg.clients[0].W.W.callback("2captcharesponse")", I can execute the code in console of chrome, it works well. But when I executed it in my program, it failed and tips 'unknown error: ___grecaptcha_cfg is not defined', like below, don't know why.
I tried several times but still can't solve it. Anyone has the same problem, Could you share the solution to it, thanks!

Traceback (most recent call last):
File "user_linux.py", line 127, in
driver.execute_script("___grecaptcha_cfg.clients[0].W.W.callback('{}');".format(2captcha_token))
File "C:\Users\credigoworker\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
'args': converted_args})['value']
File "C:\Users\credigoworker\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\credigoworker\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: ___grecaptcha_cfg is not defined
(Session info: chrome=70.0.3538.67)
(Driver info: chromedriver=70.0.3538.97 (d035916fe243477005bc95fe2a5778b8f20b6ae1),platform=Windows NT 10.0.17134 x86_64)

@jackylee53

This comment has been minimized.

Copy link

@jackylee53 jackylee53 commented Apr 15, 2021

Hi here is my website https://www.btgpactualdigital.com/digital/#!/entrar/login, I found the callback function is "___grecaptcha_cfg.clients[0].W.W.callback("2captcharesponse")", I can execute the code in console of chrome, it works well. But when I executed it in my program, it failed and tips 'unknown error: ___grecaptcha_cfg is not defined', like below, don't know why.
I tried several times but still can't solve it. Anyone has the same problem, Could you share the solution to it, thanks!

Traceback (most recent call last):
File "user_linux.py", line 127, in
driver.execute_script("___grecaptcha_cfg.clients[0].W.W.callback('{}');".format(2captcha_token))
File "C:\Users\credigoworker\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 636, in execute_script
'args': converted_args})['value']
File "C:\Users\credigoworker\Anaconda3\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\credigoworker\Anaconda3\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: ___grecaptcha_cfg is not defined
(Session info: chrome=70.0.3538.67)
(Driver info: chromedriver=70.0.3538.97 (d035916fe243477005bc95fe2a5778b8f20b6ae1),platform=Windows NT 10.0.17134 x86_64)

-- I found the reason because there is a iFrame.

@SagarKharche

This comment has been minimized.

Copy link

@SagarKharche SagarKharche commented Apr 16, 2021

Hello, I am using puppeteer to perform the automation so the problem I am facing is that when I call the callback function from puppeteer captcha screen still stays there and just refresh and if I call the callback function directly in browser console it works and takes me to the dashboard.

Screenshot 2021-04-16 at 8 33 43 AM

Also ___grecaptcha_cfg.clients[0].J.J.callback is string with callback function name. So could not able to call it.

await page.evaluate(function() { const response = document.getElementById("g-recaptcha-response").value; handleCaptcha(response); });

Can you please help me here?

@TranVanKung

This comment has been minimized.

Copy link

@TranVanKung TranVanKung commented Apr 20, 2021

Hi everyone. By calling ___grecaptcha_cfg.clients[0].S.S.callback() , I got Uncaught TypeError: this.updateFormValid is not a function. Where is the problem?

I met same the problem. Any one have solution, please?

@d3vr

This comment has been minimized.

Copy link

@d3vr d3vr commented Apr 20, 2021

For the people using puppeteer and trying to call function directly, in my code I just test whether it's a string or a function and either use eval or call it directly:

// ...
if(typeof findRecaptchaClients()[0]['function'] == 'string'){
    console.log('eval');
    return Promise.resolve(eval(findRecaptchaClients()[0]['function']+'("'+solution+'")'));
}else if(typeof findRecaptchaClients()[0]['function'] == 'function'){
    console.log('Direct function call');
    return Promise.resolve(findRecaptchaClients()[0]['function'](solution));
}
// ...
@TranVanKung

This comment has been minimized.

Copy link

@TranVanKung TranVanKung commented Apr 21, 2021

Hi everyone. By calling ___grecaptcha_cfg.clients[0].S.S.callback() , I got Uncaught TypeError: this.updateFormValid is not a function. Where is the problem?

Hi, the reason is, ___grecaptcha_cfg.clients[0].S.S.callback() does not know what is @this
I found the solution, you can call ___grecaptcha_cfg.clients[0].S.S.callback() with @this keyword binding to @window object, and parameter is CAPTCHA_TOKEN receive from 2captcha API. Here is the code that works for me:
___grecaptcha_cfg.clients[0].S.S.callback().call(window, CAPTCHA_TOKEN);

@wbpr

This comment has been minimized.

Copy link

@wbpr wbpr commented May 3, 2021

I'm having a problem with this website https://site.cenprotnacional.org.br/

It's not returning the callback, so it should work fine using the Solve Captcha command from the software I'm using.
image
But the command is not working properly.
So every day I need to search for the grecaptcha manually

Today is using this one ___grecaptcha_cfg.clients[0].C.C , but eventually, it'll change again.
image

Is there a way this function works on this website?

@dn250147

This comment has been minimized.

Copy link

@dn250147 dn250147 commented May 11, 2021

Never mind I fixed it, it was wrong token I put into request, awesome!

Could you provide an example of your mistake?
Did you use generated Recaptcha Token or some other token?

@sachin0174

This comment has been minimized.

Copy link

@sachin0174 sachin0174 commented May 24, 2021

image

@2captcha
Can anyone please tell me what will be my callback command.
I tried with ___grecaptcha_cfg.clients[0].Z.Z.callback('response')

but getting this error ___grecaptcha_cfg.clients[0].Z.Z.callback is not a function

your help will be much appreciated.
Thanks

@doorsthatopen

This comment has been minimized.

Copy link

@doorsthatopen doorsthatopen commented May 28, 2021

Screen Shot 2021-05-28 at 10 05 43 AM

Getting callback as null. How should I proceed? Read in previous comments to hit submit button, but it is not displaying.

@kratzky

This comment has been minimized.

Copy link

@kratzky kratzky commented May 28, 2021

@doorsthatopen

Getting callback as null. How should I proceed? Read in previous comments to hit submit button, but it is not displaying.

there's clearly visible Find button, just click it.

@doorsthatopen

This comment has been minimized.

Copy link

@doorsthatopen doorsthatopen commented May 28, 2021

@doorsthatopen

Getting callback as null. How should I proceed? Read in previous comments to hit submit button, but it is not displaying.

there's clearly visible Find button, just click it.

That wouldn't work as a I need to submit the captcha prior to hitting find. The captcha isn't solved until I submit the actual token. Included code snippet below. Don't know what to do after last line

u1 = f"https://2captcha.com/in.php?key={API_KEY}&method=userrecaptcha&googlekey={data_sitekey}&pageurl={page_url}&json=1&invisible=1"
r1 = requests.get(u1)
rid = r1.json().get("request")
u2 = f"https://2captcha.com/res.php?key={API_KEY}&action=get&id={int(rid)}&json=1"
time.sleep(5)
while True:
r2 = requests.get(u2)
if r2.json().get("status") == 1:
form_tokon = r2.json().get("request")
break
time.sleep(5)
wirte_tokon_js = f'document.getElementById("g-recaptcha-response").innerHTML="{form_tokon}";'
browser.execute_script('document.getElementById("g-recaptcha-response").style.display="block";')
time.sleep(5)
browser.execute_script(wirte_tokon_js)

@doorsthatopen

This comment has been minimized.

Copy link

@doorsthatopen doorsthatopen commented Jun 3, 2021

@doorsthatopen

Getting callback as null. How should I proceed? Read in previous comments to hit submit button, but it is not displaying.

there's clearly visible Find button, just click it.

That wouldn't work as a I need to submit the captcha prior to hitting find. The captcha isn't solved until I submit the actual token. Included code snippet below. Don't know what to do after last line

u1 = f"https://2captcha.com/in.php?key={API_KEY}&method=userrecaptcha&googlekey={data_sitekey}&pageurl={page_url}&json=1&invisible=1"
r1 = requests.get(u1)
rid = r1.json().get("request")
u2 = f"https://2captcha.com/res.php?key={API_KEY}&action=get&id={int(rid)}&json=1"
time.sleep(5)
while True:
r2 = requests.get(u2)
if r2.json().get("status") == 1:
form_tokon = r2.json().get("request")
break
time.sleep(5)
wirte_tokon_js = f'document.getElementById("g-recaptcha-response").innerHTML="{form_tokon}";'
browser.execute_script('document.getElementById("g-recaptcha-response").style.display="block";')
time.sleep(5)
browser.execute_script(wirte_tokon_js)

@khaelou @2captcha @kratzky
Does anyone know how I can solve this? Thanks

@khaelou

This comment has been minimized.

Copy link

@khaelou khaelou commented Jun 8, 2021

@doorsthatopen I can’t provide any code as I don’t understand your code enough to improve but here are the steps you need to take.

  1. Send solved key back to target site recaptcha via “g-recaptcha-response” element
  2. Pass the solved key to the callback function as a parameter
  3. Submit form after callback execution
@GhaithAlHallak8

This comment has been minimized.

Copy link

@GhaithAlHallak8 GhaithAlHallak8 commented Jun 9, 2021

Hi, I'm doing everything correctly but always getting the callback function as null, so what's wrong? and what should I do in this case?. BTW that's not my first time using 2captcha, so I have some experience with it.

@wbpr

This comment has been minimized.

Copy link

@wbpr wbpr commented Jun 21, 2021

I'm having a problem with this website https://site.cenprotnacional.org.br/

It's not returning the callback, so it should work fine using the Solve Captcha command from the software I'm using.
image
But the command is not working properly.
So every day I need to search for the grecaptcha manually

Today is using this one ___grecaptcha_cfg.clients[0].C.C , but eventually, it'll change again.
image

Is there a way this function works on this website?

Does anyone know or have any hint of how to make this function work on this website?

@BlondinkaQ

This comment has been minimized.

Copy link

@BlondinkaQ BlondinkaQ commented Sep 3, 2021

this solve for selenium
driver.execute_script(f"window[___grecaptcha_cfg.clients[0].A.A.callback]('{TOKEN_CAPTCHA}')")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment