'Solving HCAPTCHA with selenium

I've been trying for a week now to solve hcaptcha with selenium, but everytime when I try to submit is says captcha not solved

captchaSolution = get_Task()
print(f"Captcha solution: {captchaSolution}")
driver.execute_script(f"document.getElementsByName('h-captcha-response')[0].value = '{captchaSolution}';")
driver.execute_script(f"document.getElementsByName('g-recaptcha-response')[0].value = '{captchaSolution}';")

It changes the hcaptcha value with the solution but it doesn't say that it's solved, does anyone know what I'm doing wrong



Sources

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

Source: Stack Overflow

Solution Source