3

I am trying to bypass hcaptcha on cloudflare anti-ddos loading page using webdriver in python selenium. Basically i have got to the point when the token is put in h-captcha-response and g-recaptcha-response fields and i can submit hcaptcha form. The problem is when i try to submit it, hcaptcha area looks like it reloads and after trying to submit it again it constantly happens. Is there a chance for some kind of ban on my user-agent? What's more i sometimes get 502 http error after submitting the form.

driver.execute_script(f"document.getElementsByName('h-captcha-response')[0].innerHTML = '{token}';")
time.sleep(1)
driver.execute_script(f"document.getElementsByName('g-recaptcha-response')[0].innerHTML = '{token}';")
time.sleep(1)
driver.execute_script("document.getElementById('challenge-form').submit();")
hen
  • 65
  • 1
  • 7
  • 1
    Show your code. Make sure you're submitting the right form. – pguardiario Aug 05 '20 at 23:39
  • @pguardiario Documentation of 2captcha says that i have to insert the token received from them to h-captcha-response and g-recaptcha-response which i can do without any problem. However when i try to submit the form, it is not working. I have added the code, which does exactly that. – hen Aug 09 '20 at 21:18
  • That looks ok. Check the outgoing form submit in the network tab to make sure it's there. – pguardiario Aug 10 '20 at 00:36
  • @hen Just wondering if you ever figured this out? – presentformyfriends Apr 29 '21 at 23:20

1 Answers1

2

10 months ago, you needed

driver.execute_script(f"grecaptcha.getResponse = function(){return '{token}'}")

Now you need inject js code before all scripts on a page with injecting hcaptcha object with special attribute render for intercept a callback function. https://alexandrsokolov-41020.medium.com/%D1%80%D0%B5%D1%88%D0%B0%D0%B5%D0%BC-hcaptcha-9eebf2ee3c5a

alex
  • 165
  • 4