- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Selenium/Python 尝试填写表单,然后填写验证码。我找到了 python-anticaptcha 并购买了 10 美元的积分,一切正常,验证码出现了,但什么也没发生。我花了几个小时试图寻找答案/查阅他们的 api 和示例,但找不到任何东西。最终,验证码应该起作用,然后网站将生成一个我正在尝试进行网络抓取的表格
这就是它最终的样子,但没有任何反应,大约一分钟后它通常会退出,这就是代码
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from bs4 import BeautifulSoup
from python_anticaptcha import AnticaptchaClient, NoCaptchaTaskProxylessTask
import re
import pandas as pd
import os
import time
import requests
url = "https://claimittexas.org/app/claim-search"
driver = webdriver.Safari()
driver.implicitly_wait(30)
driver.get(url)
wait = WebDriverWait(driver, 30)
result = driver.find_element_by_xpath('//*[@id="lastName"]')
driver.execute_script("arguments[0].value='Al';",result)
time.sleep(2)
result.submit()
api_key = #MYAPIKEY
site_key = '6LeQLyEUAAAAAKTwLC-xVC0wGDFIqPg1q3Ofam5M' # grab from site
time.sleep(2)
client = AnticaptchaClient(api_key)
task = NoCaptchaTaskProxylessTask(url, site_key)
job = client.createTask(task)
job.join()
token = job.get_solution_response()
requests.post(url, data={'g-recaptcha-response': token}).text
最佳答案
在 anticaptcha.com 某人的帮助下,我解决了这个问题。
api_key = '....'
site_key = '6LeQLyEUAAAAAKTwLC-xVC0wGDFIqPg1q3Ofam5M' # grab from site
client = AnticaptchaClient(api_key)
task = NoCaptchaTaskProxylessTask(url, site_key)
job = client.createTask(task)
print("Waiting to solution by Anticaptcha workers")
job.join()
# Receive response
response = job.get_solution_response()
print("Received solution", response)
# Inject response in webpage
driver.execute_script('document.getElementById("g-recaptcha-response").innerHTML = "%s"' % response)
# Wait a moment to execute the script (just in case).
time.sleep(1)
# Press submit button
driver.find_element_by_xpath('//button[@type="submit" and @class="btn-std"]').click()
关于python - 将 anticaptcha 与 selenium 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51034252/
我正在使用以下代码通过我的 selenium 脚本添加反验证码 chrome 插件。我能够解决 goolge reCAPTCHA V2,但我无法弄清楚如何使用此插件解决 RotateCaptcha/F
我正在使用 Selenium/Python 尝试填写表单,然后填写验证码。我找到了 python-anticaptcha 并购买了 10 美元的积分,一切正常,验证码出现了,但什么也没发生。我花了几个
我最近开始在一个涉及自动化的项目中使用 selenium。该计划中的障碍之一是 ReCaptcha 系统,因此我决定使用反验证码作为解决我的机器人遇到验证码的服务。我正确安装了插件,并在他们的网站上找
我正在尝试使用 python selenium 中的 webdriver 绕过 cloudflare anti-ddos 加载页面上的 hcaptcha。基本上我已经到了将 token 放入 h-ca
我是一名优秀的程序员,十分优秀!