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
Selenium 如何判断recaptcha是否已解决?_Selenium_Recaptcha - Fatal编程技术网

Selenium 如何判断recaptcha是否已解决?

Selenium 如何判断recaptcha是否已解决?,selenium,recaptcha,Selenium,Recaptcha,我正在使用python selenium做一些自动化工作。但是很难绕过recaptcha。因此我决定手动解决recaptcha。以下是概要: #run script #pause #solve recaptcha myself #continue script 我希望我的脚本在手动解决recaptcha后立即继续运行。因此,棘手的问题是如何判断recaptcha是否已解决。 任何想法都将不胜感激 那么您给了我们一个列表,希望我们为您创建它 这不是它的工作原理。话虽如此。。。我对验证码感兴趣。在

我正在使用python selenium做一些自动化工作。但是很难绕过recaptcha。因此我决定手动解决recaptcha。以下是概要:

#run script
#pause
#solve recaptcha myself
#continue script
我希望我的脚本在手动解决recaptcha后立即继续运行。因此,棘手的问题是如何判断recaptcha是否已解决。
任何想法都将不胜感激

那么您给了我们一个列表,希望我们为您创建它

这不是它的工作原理。话虽如此。。。我对验证码感兴趣。在解决验证码方面,我建议2captcha:

import requests
from time import sleep

# Add these values
API_KEY = ''  # Your 2captcha API KEY
site_key = ''  # site-key, read the 2captcha docs on how to get this
url = 'http://somewebsite.com'  # example url
proxy = '127.0.0.1:6969'  # example proxy

proxy = {'http': 'http://' + proxy, 'https': 'https://' + proxy}

s = requests.Session()

# here we post site key to 2captcha to get captcha ID (and we parse it here too)
captcha_id = s.post("http://2captcha.com/in.php?key={}&method=userrecaptcha&googlekey={}&pageurl={}".format(API_KEY, site_key, url), proxies=proxy).text.split('|')[1]
# then we parse gresponse from 2captcha response
recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id), proxies=proxy).text
print("solving ref captcha...")
while 'CAPCHA_NOT_READY' in recaptcha_answer:
    sleep(5)
    recaptcha_answer = s.get("http://2captcha.com/res.php?key={}&action=get&id={}".format(API_KEY, captcha_id), proxies=proxy).text
recaptcha_answer = recaptcha_answer.split('|')[1]

# we make the payload for the post data here, use something like mitmproxy or fiddler to see what is needed
payload = {
    'key': 'value',
    'gresponse': recaptcha_answer  # This is the response from 2captcha, which is needed for the post request to go through.
    }


# then send the post request to the url
response = s.post(url, payload, proxies=proxy)

这很大程度上取决于你自己如何
#解决recaptcha
谢谢,伙计。这可能是一个自动解决captcha的好主意。@bowen别担心。我自己对验证码并没有太多了解。计划最终看看,但2captcha是你能得到的最好的。文档很好。死亡验证码是另一种,但它严重缺乏文档:)嗨,伙计,很抱歉打扰你,但我遇到了一个奇怪的问题。我试图注册2captcha,但我没有连续通过“键入两个单词”部分。我键入了我看到的两个单词,并且在它们之间留了一个空格。你知道解决这个问题的正确方法吗?谢谢@伯恩,这是他们支持的问题,不是我。我不知道那是怎么回事。试着用谷歌搜索一下,或者问问他们你是否被卡住了。我已经一个月没查过验证码了。好吧。谢谢你,祝你有愉快的一天!