简体   繁体   中英

Python Captcha solved by anti captcha but can't passing response

I am using anti captcha api for solve google captcha. My captcha is solving through anticaptcha api and getting captcha response after solved captcha. I using this driver.execute_script("document.getElementById('g-recaptcha-response').innerHTML = '" + g_response + "';") for pass captcha response but nothing happening see the picture: 在此处输入图像描述

captcha is solving but I need to click on verify button by passing captcha response so I can go to the next page. here is my code:

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

You need to pass the g-response to the textarea and then click the submit button:

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)   

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