0

just as what the title states, how do i submit the hcaptcha token via python? as far as i know, generated_pass_uuid is the token. correct me if im wrong.

when i looked up other answers, it seems like i need to change the value of some hidden elements which are g-captcha-response and h-captcha-response to the token i have.

i'm not sure how to do this, please help me out thanks. i need to scrape some old site. i've seen some code but it doesn't work and just says "Javascript Error: token is unexpected"

from selenium import webdriver
import time
driver = webdriver.Chrome()
driver.get("https://accounts.hcaptcha.com/demo")
token = "generated pass uuid token here"

driver.execute_script('''                                                                                                                                                   
  let [captcha] = arguments
  let css = '[name="h-captcha-response"], [name="g-recaptcha-response"]'
  [...document.querySelectorAll(css)].map(el => {                                                          
    el.innerHTML = captcha
  })
''', token)
time.sleep(999)

0 Answers0