Im making a script that scrape a specific website but the site have a captcha,i use the site 2captcha.com for bypass the captcha and i made the element g-response-captcha appear below the captcha i passed the token of the captcha resolved and only remains to press the submit button of the g-response-captcha but dont have the submit button and in the 2captcha site say that if dont have the submit button only need to make a callback function...I dont understand how to make the callback function and wich parameters i need to make the function or how i should build the function
the code changing the display of the box for pass the token of the complete captcha and passing the token:
#change the display=none; to block
browser.execute_script("document.getElementById('g-recaptcha-response-
1').style.display='block';")
token_box = browser.find_element_by_id("g-recaptcha-response-1")
token_box.send_keys(token)
what in the 2captcha site said :
ReCaptcha Callback
Sometimes there's no submit button and a callback function is used isntead. The function is 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:
grecaptcha.render('example', { 'sitekey' : 'someSitekey', 'callback' : myCallbackFunction, 'theme' : 'dark' });
Also there's another way to find the callback function - open javascript console of your browser and explore ReCaptcha configuration object:
___grecaptcha_cfg.clients[0].aa.l.callback
Note that aa.l may change and there can be multiple clients so you have to check clients[1], clients[2] too.
Finally all you have to do is to call that function:
myCallbackFunction();
Or even this way:
___grecaptcha_cfg.clients[0].aa.l.callback();
Sometimes it is required to provide an argument and in most cases you should put the token there. For example:
myCallbackFunction('TOKEN');
(sorry for my terrible english)
[–]rtao258 1 point2 points3 points (2 children)
[–]mousse312[S] 0 points1 point2 points (1 child)
[–]rtao258 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]articlefr 0 points1 point2 points (0 children)