2

I have a chrome extension for particular page.

The submit button should be auto-clicked as soon as reCaptcha solved.

I tried like below, but not work.

function myCallBack() {
  var submit = document.getElementId("submit_btn");
  if (submit) {
    submit.click();
    console.log("submit clicked");
  }
}

$("div.g-recaptcha").attr("data-callback", "myCallBack");

I get console log like below:

ReCAPTCHA couldn't find user-provided function: myCallBack

How to solve this problem? Help me please.

  • which version are you using? – Anurag R Dec 20 '19 at 04:36
  • @AnuragR you mean reCaptcha version? I think it is reCaptcha v2. –  Dec 20 '19 at 04:40
  • Found some similar questions. [recaptcha-couldnt-find-user-provided-function-mycallback](https://stackoverflow.com/questions/44567543/recaptcha-couldnt-find-user-provided-function-mycallback) [google-recaptcha-data-callback-not-working](https://stackoverflow.com/questions/35614606/google-recaptcha-data-callback-not-working) – Anurag R Dec 20 '19 at 04:45
  • I haven't got source code of the web page. should be solved with only extension. –  Dec 20 '19 at 05:12

1 Answers1

1

Here you go. this will work on all sites when a captcha is clicked. and in order to run this on any site. use "Custom Javascript For Websites 2" Extention for chrome. Change 'button[type="submit"]' to the button reference that needs to be clicked after.

let captcha_passed = setInterval(function(){
    if(typeof grecaptcha !== "undefined"){
        let gr = grecaptcha.getResponse();
        if(gr !== ""){
            clearInterval(captcha_passed);
            $('input.btn[name="captcha"]').click();
            $('button[type="submit"]').click();
        }
    }

}, 500);