简体   繁体   中英

H-Captcha, can't fill the token in h-captcha-response innerHTML and g-recaptcha-response innerHTML

I'm trying to bypass a Hcaptcha with 2captcha thank to selenium and 2captcha in python.

When I receive my 2captcha token, I try to fill my token in both textareas named 'h-captcha-response' and 'g-captcha-response'

But it doesn't work.

Both textareas have ids with the pattern "h-captacha-[ID]" and "g-recaptacha-[ID]"

My problem is : As soon as I want to fill the innerHTML of the textareas, it returns me an error because I can't get the 2 items correctly

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

Do you know why my driver.execute_script command doesn't work ? Code is the good token for the captcha, i need to send it in the 2 textareas.

Here is the error

selenium.common.exceptions.JavascriptException: Message: javascript error: Cannot read properties of undefined (reading 'map')

That js is getting mangled. This looks right to me

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM