1

I am trying to fill recaptcha using anticaptcha api.

But I am unable to figure out how to submit response.

Here is what I am trying to do:

driver.switch_to.frame(driver.find_element_by_xpath('//iframe'))

url_key = driver.find_element_by_xpath('//*[@id="captcha-submit"]/div/div/iframe').get_attribute('src')
#site_key = re.search('k=([^&]+)',url_key).group(1)
site_key = '6Ldd2doaAAAAAFhvJxqgQ0OKnYEld82b9FKDBnRE'
api_key = 'api_keys'
url = driver.current_url

client = AnticaptchaClient(api_key)
task = NoCaptchaTaskProxylessTask(url, site_key)
job = client.createTask(task)
job.join()

driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML='{}';".format(job.get_solution_response()))

driver.refresh()

Above code snippet only refreshes the same page and not redirecting to input url.

Then I see that there is a variable in script on the same page and I tried to execute that variable too to submit form just like that

driver.execute_script("var captchaSubmitEl = document.getElementById('captcha-submit');")

driver.refresh()

Which also fails.The webpage is here.

0 Answers0