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.