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'))


site_key = '6Ldd2doaAAAAAFhvJxqgQ0OKnYEld82b9FKDBnRE'
api_key = 'api_keys'
url = 'https://coinsniper.net/register'

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.

Second try with this url which is loading recpatcha of the same page.

But this time I tried with different site_key and url which were extracted as below

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)

url = 'https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMABhLJ2Rn0V78AZ5gFAg%3D%3D&hash=7F23E8F8FB0B33347C06D1347938C1&cid=.z5o-mMJuvaX_CLxOMBRebJsY6NgZvUv87bLMft~A_st0Fkvl~3jcaTr1R64GU7xO.WZFYNq5P3.UNuLWFa32.Pe6GGuIV7Y5w-RaMu0K3&t=fe&referer=https%3A%2F%2Fcoinsniper.net%2Fregister&s=33682'

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 both ways are, I don't know why but, not working. I am finding solution from previous 3 days and got not any single solution working in my case.

Can anyone look into this and let me know what is wrong with this code.

Taimorr Mughal
  • 87
  • 1
  • 10
  • 1
    That's the wrong id, it should be `g-recaptcha-response-100000`, but that's not even in a form. Then there's another captcha to deal with. This one looks tricky, I don't think you're going to get it. – pguardiario Aug 12 '21 at 01:00
  • @pguardiario I have handled text captcha but I don't know how to get rid of captcha which is redirected to this [page](https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMABhLJ2Rn0V78AZ5gFAg%3D%3D&hash=7F23E8F8FB0B33347C06D1347938C1&cid=.z5o-mMJuvaX_CLxOMBRebJsY6NgZvUv87bLMft%7EA_st0Fkvl%7E3jcaTr1R64GU7xO.WZFYNq5P3.UNuLWFa32.Pe6GGuIV7Y5w-RaMu0K3&t=fe&referer=https%3A%2F%2Fcoinsniper.net%2Fregister&s=33682) – Taimorr Mughal Aug 13 '21 at 06:04

1 Answers1

2

After you receive a response from anti-captcha you should set it to this element

<input type="hidden" class="mtcaptcha-verifiedtoken" name="mtcaptcha-verifiedtoken" id="mtcaptcha-verifiedtoken-1" readonly="readonly" value="">

Fill in all other fields on UI and click the Register button. You should not refresh the page.

shatulsky
  • 306
  • 2
  • 10
  • thanks for looking into it. The problem occur when that page redirected to this [one](https://geo.captcha-delivery.com/captcha/?initialCid=AHrlqAAAAAMABhLJ2Rn0V78AZ5gFAg%3D%3D&hash=7F23E8F8FB0B33347C06D1347938C1&cid=.z5o-mMJuvaX_CLxOMBRebJsY6NgZvUv87bLMft~A_st0Fkvl~3jcaTr1R64GU7xO.WZFYNq5P3.UNuLWFa32.Pe6GGuIV7Y5w-RaMu0K3&t=fe&referer=https%3A%2F%2Fcoinsniper.net%2Fregister&s=33682) – Taimorr Mughal Aug 10 '21 at 11:25
  • ReCaptcha could be solved with the same approach. But after filling the hidden input instead of clicking on the Register button - click on the Recaptcha checkbox. – shatulsky Aug 10 '21 at 11:29
  • When I click on that checkbox after filling in `textarea` with `execute_script`,it pops-up with challenge to resolve. – Taimorr Mughal Aug 10 '21 at 11:35
  • You may try to figure out how it's working using JS in that page source. It is not obfuscated. You may also try to submit elements instead of clicking them. – shatulsky Aug 11 '21 at 10:22
  • Still not getting any luck. Will you try it? – Taimorr Mughal Aug 11 '21 at 11:46
  • This question is about 'I am not robot' captcha challenge not for text captcha. Hope you're getting my point! – Taimorr Mughal Aug 11 '21 at 12:42