Home:ALL Converter>Python selenium Captcha not accepting 2Captcha response code

Python selenium Captcha not accepting 2Captcha response code

Ask Time:2022-04-26T22:44:41         Author:kkkkmert

Json Formatter

I am trying to solve the captcha with javascript via 2captcha but i had an issue like that. I am using 2Captcha API on my Python project and gave the captcha sitekey on that site which is 40 string lenght. After I get an result code like as expected. But when I tried to paste it to 'g-recaptcha-anchor' textarea and click the green register button, it said the captcha is wrong and I am still stuck on that register site. Am I usin wrong site key ? Thanks for the help. There's a piece of code I am using ;

 while True:
            try:
                google_captcha_response_input = driver.find_element(
                    By.ID, 'g-recaptcha-response')
                break
            except:
                time.sleep(2)
    
driver.execute_script(
    "arguments[0].setAttribute('style','type: text; visibility:visible;');",
     google_captcha_response_input)
google_captcha_response_input.send_keys(response.get('code'))

After get an error with that code block, I tried to click the captcha button too for test, but thats not working too,

my error

Author:kkkkmert,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72015996/python-selenium-captcha-not-accepting-2captcha-response-code
yy