'Python selenium Captcha not accepting 2Captcha response code

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



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source