3

I am trying to call a function from my browser console. But every time I try, the console returns me an error message.

But I am able to reach that function via another function here it is:

enter image description here

as you can see the function is called "onCaptchaSubmitted"

This is what happens when I try to call it from the console:

enter image description here

Finally, this also shows how that function implemented:

I do not know how to call that function. There must be a way to call it directly but how?

Thanks for your help..

Ahmet Aziz Beşli
  • 1,280
  • 3
  • 19
  • 38
  • 1
    The bundled code most likely runs within its own function scope. So unless you explicitly bind the function you want to call to the window object, then you can't call it. – Olian04 Aug 31 '20 at 12:06
  • @Olian04 then how can I bind that function ? – Ahmet Aziz Beşli Aug 31 '20 at 12:19
  • 1
    Depends on your exact setup, but this works in general `window.onCaptchaSubmitted = onCaptchaSubmitted;` – Olian04 Aug 31 '20 at 12:20
  • @Olian04 it will work, but `onCaptchaSubmitted` has `this` inside. That can cause problems... – Anton Aug 31 '20 at 15:01
  • @Anton actually it didn't work – Ahmet Aziz Beşli Aug 31 '20 at 15:02
  • @AhmetAzizBeşli what do you mean? You could not attach function to window as Olian04 told you? Or you've done it, but running it causes some problems? – Anton Aug 31 '20 at 15:03
  • @Anton window.onCaptchaSubmitted = onCaptchaSubmitted; didnot work because I'm already not able to reach that function from the console. It says the function is not defined. – Ahmet Aziz Beşli Aug 31 '20 at 15:04
  • @AhmetAzizBeşli oh, come on! You've told us: `I am able to reach that function via another function`, so just put `window.onCaptchaSubmitted = onCaptchaSubmitted;` to the place where you can see the function – Anton Aug 31 '20 at 15:06
  • @Anton I am able to reach it by **___grecaptcha_cfg.clients[0].J.J.callback** but this "J.J" letters changes all the time (randomly) and It is not good for my crawler. That's why I was looking for another solution like importing or so on – Ahmet Aziz Beşli Aug 31 '20 at 15:09
  • @AhmetAzizBeşli we do not see your code (only images), but Olian04 has a good suggestion: the function is created and visible only inside its scope. Even if you will access it from the outside, you will need to pass a `this` to it (need code analyze and reverse engineering) – Anton Aug 31 '20 at 15:14
  • 1
    Might not be what you want to hear but captchas are designed to stop robots. Lots of smart people got together to I make this as complicated as possible by design. I've even seen sites have other anti-automation solutions after captchas.. I'm Not saying it's impossible but you're going to be facing an uphill struggle to get it working (sorry) – RichEdwards Aug 31 '20 at 17:13

0 Answers0