javascript - 使用 selenium 和 anticaptchaofficial 解决验证码
问题描述
我一直在尝试使用 selenium 和 anticaptchaofficial来解决此页面上的验证码。一切正常.. 它返回 g_response。但是当我在网站上应用它时,它什么也没做。
from anticaptchaofficial.recaptchav2proxyless import *
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get('https://ferrarif430.blogabet.com/pick/17aecf79217c92f6041db4fb25997474')
solver = recaptchaV2Proxyless()
solver.set_verbose(1)
solver.set_key("KEY")
solver.set_website_url('https://thegeniustips.blogabet.com/pick/4848ea9854a93d80f7c680f5f3a1f2aa')
solver.set_website_key("6LczfBcTAAAAAJUj9xaEanJHszjBkgr9kQQgyNPI")
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 = "%s"' % g_response)
time.sleep(5)
WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe[src^='https://www.google.com/recaptcha/api2/anchor']")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "div.recaptcha-checkbox-border"))).click()
它将响应应用于 Javascript,但它不执行任何操作。我做错什么了吗?
我还尝试使用 URL 访问它。
'https://thegeniustips.blogabet.com/pick/4848ea9854a93d80f7c680f5f3a1f2aa?g-recaptcha-response= + "g_response"'
但它返回了访问受限错误。
如何使用 g_response 访问此页面?它不一定是硒。即使是普通的 URL 请求也可以。
谢谢你。
ps - 如果您无法从链接中获得验证码,请发表评论。我会更新它
解决方案
推荐阅读
- javascript - Vue不从扩展面板更改数组数据并激活加载器
- android - 有没有办法在不注销用户的情况下一键弹出 Flutter 应用程序中的所有屏幕?
- reactjs - 如何在 Next-auth 中获取当前会话提供者
- node-red - Node-RED 守护程序节点“命令未运行”
- python - 遍历字典以创建 csv 文件
- awk - awk/gawk 数组连接成字符串失败
- python - PyTorch 已安装但导入时无法加载
- javascript - 在多行字符串中,如何匹配每行以管道字符开头的新行序列
- php - PHP到GEOJSON数组不循环MYSQL数据库中的行
- vue.js - Vue.js deep watching of computed property using other computed property objects