How can I input a recapcha key into a costum site using selenium?

Crissy

New member
#1
I am trying to solve a captcha using api from 2cap. It works to get the captcha key but i am stuck. I dont know how to "input" it into recaptcha. I would be very happy when somebody can send me an example of how it works in exact this site. The person thats help me solving will get some money on paypal (only if the person wants) and I am giving this money cause I get money for that project so its only fair. And btw sorry for my english.

MY CODE:
Code:
# Solve reCaptcha V2 with Selenium Python Using 2captcha
from selenium import webdriver
import requests, time

API_KEY = "MYAPIKEY"
data_sitekey = '6Ldu0RETAAAAAFRTCzycHREmOKJzX3ZCutyhHjEc'
page_url ='https://www.o2.co.uk/shop/sim-cards/pay-as-you-go/delivery?planId=1a209061-ba66-47c9-9387-1af8ce8dd0be'

def Solver():
    driver = webdriver.Chrome()
    driver.get(page_url)
    u1 = f"https://2captcha.com/in.php?key={API_KEY}&method=userrecaptcha&googlekey={data_sitekey}&pageurl={page_url}&json=1&invisible=1"
    r1 = requests.get(u1)
    print(r1.json())
    rid = r1.json().get("request")
    u2 = f"https://2captcha.com/res.php?key={API_KEY}&action=get&id={int(rid)}&json=1"
    time.sleep(5)
    while True:
        r2 = requests.get(u2)
        print(r2.json())
        if r2.json().get("status") == 1:
            form_tokon = r2.json().get("request")
            break
        time.sleep(5)
    time.sleep(999)

if __name__ == '__main__':
    Solver()