1

I've been trying to click recaptcha checkmark box through script unsuccessfully for a while now and don't know why:

I've inspected the checkmark box and copied the JS path and stored it into variable captchaBox, and If I run this script through the console when the recaptcha is on screen it does run, but with my script it doesn't.

function solveCaptcha(){
    let captchaBox = document.querySelector("#recaptcha-anchor-label")
    captchaBox.click()
}

function clickSomething(){
    let randomBTN = document.querySelector('selector for random button')
    randomBTN.click()
    solveCaptcha() //Here I tried setTimeout(solveCaptcha,3000)
}

After I call clickSomething(), which works, the captcha won't solve (it will appear after clicking the button). I tried to put some setTimeout for the captcha so the recaptcha window has some time to pop up and then it can execute the solveCaptcha(), but still doesn't work and I can't figure out how to run it.

Lmfao
  • 23
  • 4
  • 2
    so, you want to click one of those "I am not a robot" things using a script? Can you see the irony? – Jaromanda X Sep 30 '22 at 00:30
  • 2
    The whole point of those captchas are so you *cant* click them automatically. – kelsny Sep 30 '22 at 01:37
  • Okay, Thanks guys, so its impossible to solve captcha with scripts because it pervents bots thanks, didn't know its impossible, was expecting some kind of answer which would lead me to actually success – Lmfao Oct 02 '22 at 20:00

1 Answers1

-1

Try using a Captcha solve provider like 2captcha. If this is for Recaptcha try https://2captcha.com/p/recaptcha_v2

They will provide you with a JSON code which you can apply to the page and will solve the captcha. Hope this helps

hdsouza
  • 354
  • 4
  • 17
  • unfortunately, using solve provider is way too slow for my task, I was looking for the clicking the reCaptcha 'oneclick', if challange occures I quit the task. Basically was just trying to click the checkbox. Iam currently using the python pyautogui to click it, which requires display but works. I was looking for a JS way to solve this issue, to be able to run for example headless browser. (the goal is to click the recaptcha checkbox as fast as it appears). – Lmfao Oct 30 '22 at 11:57
  • If you quit the task and retry, that will make the challenge even more difficult the next time and successfully more difficult every-time. You may want to learn about Captchas and how they work. – hdsouza Oct 31 '22 at 12:45
  • I know good amount of stuff about captcha and how it resets. edit: was too specific on what am I doing, not necessary. – Lmfao Oct 31 '22 at 13:24