1

I am trying to submit recaptcha on a form that doesn't have a submit button using using Python3, Selenium, and 2captcha. I'm pretty new to selenium and trying to bypass captcha on website https://id.rambler.ru/login-20/mail-registration All the code is working fine except I don't know how to submit the captcha token and the form after the captcha token is given.

Here is the code so far:

browser = webdriver.Chrome("chromedriver.exe")
browser.get('https://id.rambler.ru/login-20/mail-registration?')
time.sleep(7)

WebDriverWait(browser, 2).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe[name^='a-'][src^='https://www.google.com/recaptcha/api2/anchor?']"))) #https://www.google.com/recaptcha/api2/anchor?
WebDriverWait(browser, 2).until(EC.element_to_be_clickable((By.XPATH, "//span[@id='recaptcha-anchor']")))
print('recaptcha found')
time.sleep(7)

url = f'https://2captcha.com/in.php?key={api_key}&method=userrecaptcha&googlekey={site_key}&pageurl={page_url}&json=1&invisible=1'
req = requests.get(url)
print(req.json())
rid = req.json().get("request")
url2 = f"http://2captcha.com/res.php?key={api_key}&action=get&id={rid}&json=1"
time.sleep(2)

while True:
    r2 = requests.get(url2)
    print(r2.json())
    if r2.json().get("status") == 1:
        form_tokon = r2.json().get("request")
        break
    time.sleep(5)
print(form_tokon)
time.sleep(5)
Jarvn
  • 43
  • 6
  • The api docs should help you solve this. You want to set it in javascript and submit the form – pguardiario Aug 06 '21 at 01:58
  • Sorry about the late response, but what do you mean set it in javascript and submit the form? I looked at the docs and didn't find anything. – Jarvn Aug 18 '21 at 14:59

1 Answers1

-1

The entire point of a captcha is to prevent people from automating certain tasks (such as the form you are trying to automate with Selenium).

Captcha stands for Completely Automated Public Turing test to tell Computers and Humans Apart. Although there may be bypasses, the captchas are constantly updated to close these workarounds, so it is unlikely you will be able to find any way use an automation tool to bypass a captcha.

  • While you are correct in general, this does not help the OP. The original post specifies "... and 2captcha". See https://2captcha.com/ service. – SiKing Aug 03 '21 at 23:20