Python验证码通过反验证码解决,但无法传递响应

xriantvc  于 2023-03-28  发布在  Python
关注(0)|答案(2)|浏览(183)

我正在使用反验证码API来解决谷歌验证码。我的验证码是通过anticaptcha api解决,并在解决验证码后获得验证码响应。我使用这个driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '" + g_response + "';")来传递验证码响应,但没有发生任何事情,请参阅图片:

验证码正在解决,但我需要通过传递验证码响应来单击验证按钮,这样我就可以转到下一页。下面是我的代码:

email = driver.find_element_by_xpath("")
email.send_keys('')
password = driver.find_element_by_xpath("")
password.send_keys('')
button = driver.find_element_by_css_selector('')
button.click()

    solver = recaptchaV2Proxyless()
    solver.set_verbose(1)
    solver.set_key("my api key ")
    solver.set_website_url("website url")
    solver.set_website_key("captcha site key")
    
    g_response = solver.solve_and_return_solution()
    if g_response != 0:
        print ("g-response: "+g_response)
    else:
        print ("task finished with error "+solver.error_code)
    
    
    time.sleep(3)
    
    driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '" + g_response + "';") #I am using this for pass captcha response but captcha is solving but response not passing
plupiseo

plupiseo1#

您需要将g-response传递到textarea,然后单击submit按钮:

solver = recaptchaV2Proxyless()
solver.set_verbose(1)
solver.set_key("my api key ")
solver.set_website_url("website url")
solver.set_website_key("captcha site key")        
g_response = solver.solve_and_return_solution()

if g_response != 0:
    print ("g-response: "+g_response)  
    driver.execute_script(f'document.getElementsByName("gRecaptchaResponse").innerHTML="{g_response}"')
    driver.find_element(By.XPATH, '//*[@id="recaptcha-demo-submit"]').click() # xpath of textarea submit button
else:
    print ("task finished with error "+solver.error_code)
ghhkc1vu

ghhkc1vu2#

我也有同样的问题与反验证码.我认为,当验证码的敏感性增加,请求将超时.现在我使用metabypass.https://metabypass.tech
Recaptcha版本2的实现文档几乎与anti-captcha相似,但我认为它的速度和质量要高得多。
在给你的钱包充电之前,先测试他们的服务。注册后,他们会给钱包充电,所以先测试服务。

相关问题