title: How to identify the 32 bit data-sitekey of ReCaptcha V2 to obtain a valid response programmatically using Selenium and Python Requests?
body: <p>Pretty much new with captcha and Python requests. The <a href="https://2captcha.com/2captcha-api#solving_recaptchav2_new" rel="nofollow noreferrer">captcha documentation</a> says to copy the value of <code>data-sitekey</code> parameter.</p>
  
  <p>Here was my attempt, using <a href="https://stackoverflow.com/questions/54459701/what-is-selenium-and-what-is-webdriver/54482491#54482491">Selenium</a> to open the url and using Python <code>requests</code> to get a response. </p>
  
  <pre><code>mainurl = 'https://imagetyperz.xyz/automation/recaptcha-v2.html'
  driver.get(mainurl)
  data_sitekey_class = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CLASS_NAME, "g-recaptcha"))).get_attribute("data-sitekey")
  print(data_sitekey_class)
  src_css_selector = driver.find_element_by_css_selector("iframe[role='presentation']").get_attribute("src")
  print(src_css_selector)
  keygoogle = src_css_selector[52:92]
  print('Site Key = ', keygoogle)
  data_post = {'key': data_sitekey_class, 'method': 'userrecaptcha', 'googlekey': keygoogle, "pageurl": mainurl}
  response = requests.post(url = 'https://2captcha.com/in.php', data = data_post )
  print(response)
  print(response.text)
  </code></pre>
  
  <p>I am getting <code>200</code> as response:</p>
  
  <pre><code>6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY
  https://www.google.com/recaptcha/api2/anchor?ar=1&amp;k=6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY&amp;co=aHR0cHM6Ly9pbWFnZXR5cGVyei54eXo6NDQz&amp;hl=en&amp;v=vJuUWXolyYJx1oqUVmpPuryQ&amp;size=normal&amp;cb=r14cgu7t25ul
  Site Key =  6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY
  &lt;Response [200]&gt;
  ERROR_WRONG_USER_KEY
  </code></pre>
  
  <p>which is due to:</p>
  
  <pre><code>ERROR_WRONG_USER_KEY
  </code></pre>
  
  <p>Further, <a href="https://2captcha.com/2captcha-api#in_errors" rel="nofollow noreferrer">Error</a> section mentions:</p>
  
  <pre><code>Error code: ERROR_WRONG_USER_KEY
  Description: You've provided key parameter value in incorrect format, it should contain 32 symbols.
  Action: Stop sending requests. Check your API key.
  </code></pre>
  
  <p>Finally, <a href="https://2captcha.com/2captcha-api#solving_captchas" rel="nofollow noreferrer">Solving Captchas</a> section mentions:</p>
  
  <p>Get your API key from your account settings page. Each user is given a unique authentication token, we call it API key. It's a 32-characters string that looks like:</p>
  
  <pre><code>1abc234de56fab7c89012d34e56fa7b8
  </code></pre>
  
  <p>Where as the <code>data-sitekey</code> I am seeing is:</p>
  
  <pre><code>6LdXeIYUAAAAAFmFKJ6Cl3zo4epRZ0LDdOrYsvRY
  </code></pre>
  
  <p>which is <strong>41</strong> bit.</p>
  
  <p>Where am I going wrong?</p>