1

I'm using 2captcha and selenium, I get a code generated to solve but I'm not able to submit it. I tried this solution Python + Selenium + 2Captcha but I can't manage to make it click.

resp = requests.get(url)

if resp.text[0:2] != 'OK':
    quit('Service error. Error code:' + resp.text)
captcha_id = resp.text[3:]

fetch_url = "http://2captcha.com/res.php?key="+ service_key + "&action=get&id=" + captcha_id

for i in range(1, 10):
    sleep(5) # wait 5 sec.
    resp = requests.get(fetch_url)
    if resp.text[0:2] == 'OK':
        break

driver.execute_script('var element=document.getElementById("g-recaptcha-response"); element.style.display="";')
driver.execute_script('document.getElementById("g-recaptcha-response").innerHTML = arguments[0]', resp.text[3:])
driver.execute_script('onSubmit(arguments[0])', resp.text[3:])

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.