Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python+;Selenium:在提交响应后完成recaptcha?_Python_Selenium_Selenium Webdriver - Fatal编程技术网

Python+;Selenium:在提交响应后完成recaptcha?

Python+;Selenium:在提交响应后完成recaptcha?,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,到目前为止,我的代码按预期工作,它从captcha服务()获得“g-recaptcha-response”,并将其插入站点上的recaptcha。现在我的问题来了:提交后怎么办?即使提交了recaptcha响应,recaptcha也不会到达完成的复选标记点。我需要做的最后一步是什么来完成这里的重述?提前感谢:] Python代码: from selenium import webdriver from selenium.webdriver.chrome.options import Option

到目前为止,我的代码按预期工作,它从captcha服务()获得“g-recaptcha-response”,并将其插入站点上的recaptcha。现在我的问题来了:提交后怎么办?即使提交了recaptcha响应,recaptcha也不会到达完成的复选标记点。我需要做的最后一步是什么来完成这里的重述?提前感谢:] Python代码:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from anticaptchaofficial.recaptchav2proxyless import *

DRIVER = webdriver.Chrome("C:\\Users\\User\\Desktop\\chromedriver.exe")
DRIVER.get("https://patrickhlauke.github.io/recaptcha/")

data_sitekey = WebDriverWait(DRIVER, 20).until(EC.element_to_be_clickable((By.CLASS_NAME, "g-recaptcha"))).get_attribute("data-sitekey")
print(data_sitekey)

solver = recaptchaV2Proxyless()
solver.set_verbose(1)
solver.set_key("135986148491286418614")
solver.set_website_url("https://patrickhlauke.github.io/recaptcha/")
solver.set_website_key(data_sitekey)

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)

DRIVER.execute_script("document.getElementById('g-recaptcha-response').innerHTML='" + g_response + "';");

#execute_script(submit button)??? or what do i need to do here to finish the captcha