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.

2
  • 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. Commented Aug 12, 2021 at 1:00
  • @pguardiario I have handled text captcha but I don't know how to get rid of captcha which is redirected to this page Commented Aug 13, 2021 at 6:04

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

6 Comments

thanks for looking into it. The problem occur when that page redirected to this one
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.
When I click on that checkbox after filling in textarea with execute_script,it pops-up with challenge to resolve.
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.
Still not getting any luck. Will you try it?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.