How to identify the 32 bit data-sitekey of ReCaptcha V2 to obtain a valid response programmatically using Selenium and Python Requests? How to identify the 32 bit data-sitekey of ReCaptcha V2 to obtain a valid response programmatically using Selenium and Python Requests? selenium selenium

How to identify the 32 bit data-sitekey of ReCaptcha V2 to obtain a valid response programmatically using Selenium and Python Requests?


data-sitekey represented through 41-characters string works just fine. The error ERROR_WRONG_USER_KEY occurred as I never had a valid API key ready in the first place. Even with Zero balance in your account, you can successfully obtain a <Response [200]> with text as ERROR_ZERO_BALANCE as follows:

  • Code Block:

    from selenium import webdriverfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support import expected_conditions as ECimport requestsoptions = webdriver.ChromeOptions() options.add_argument("start-maximized")options.add_experimental_option("excludeSwitches", ["enable-automation"])options.add_experimental_option('useAutomationExtension', False)driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')mainurl = 'https://imagetyperz.xyz/automation/recaptcha-v2.html'driver.get(mainurl)data_sitekey = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CLASS_NAME, "g-recaptcha"))).get_attribute("data-sitekey")print(data_sitekey)api_key = '--------------------------------'data_post = {'key': api_key, 'method': 'userrecaptcha', 'googlekey': data_sitekey, "pageurl": mainurl}response = requests.post(url = 'https://2captcha.com/in.php', data = data_post )print(response)print(response.text)
  • Console Output:

    6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY<Response [200]>ERROR_ZERO_BALANCE