Selenium python 2captcha submit missing

Roreeg

New member
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:

Code:
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)
 

Pharirmi

New member
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:

Code:
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)
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.