Python 改进reCaptcha 2.0解决自动化脚本(Selenium)

Python 改进reCaptcha 2.0解决自动化脚本(Selenium),python,selenium,captcha,recaptcha,Python,Selenium,Captcha,Recaptcha,我已经用selenium代码编写了一个python来解决这个问题。但在完全模仿用户行为方面还缺少一些东西:代码可以定位并点击验证码,但在这之后谷歌设置了额外的图片检查 这不容易自动化。如何改进代码,在不检查图片的情况下立即解决验证码问题(让谷歌不显示机器人的存在) Python代码 你不能这样做,我认为当太多的请求都来自同一个IP时会使用镜像障碍,所以你不能绕过它,你可以做的是使用代理,这是我的解决方案: # -*- coding: utf-8 -*- from selenium import

我已经用selenium代码编写了一个python来解决这个问题。但在完全模仿用户行为方面还缺少一些东西:代码可以定位并点击验证码,但在这之后谷歌设置了额外的图片检查

这不容易自动化。如何改进代码,在不检查图片的情况下立即解决验证码问题(让谷歌不显示机器人的存在)

Python代码
你不能这样做,我认为当太多的请求都来自同一个IP时会使用镜像障碍,所以你不能绕过它,你可以做的是使用代理,这是我的解决方案:

# -*- coding: utf-8 -*-

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait

driver = webdriver.Chrome()

driver.get(url='https://www.google.com/recaptcha/api2/demo')

# find iframe
captcha_iframe = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.TAG_NAME, 'iframe'
        )
    )
)

ActionChains(driver).move_to_element(captcha_iframe).click().perform()

# click im not robot
captcha_box = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.ID, 'g-recaptcha-response'
        )
    )
)

driver.execute_script("arguments[0].click()", captcha_box)

它有用吗?它有多稳定(在谷歌设置图像拼图之前它可能成功解决多少次)?我强烈建议先运行它。。。很难说它的稳定性。它通常依赖于用户代理和代理。更重要的是,您的请求不能如此频繁-使用更长的延迟可能会有所帮助。代码是怎么回事?请解释每一行。这并不能解决OP的问题。
# -*- coding: utf-8 -*-

from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait

driver = webdriver.Chrome()

driver.get(url='https://www.google.com/recaptcha/api2/demo')

# find iframe
captcha_iframe = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.TAG_NAME, 'iframe'
        )
    )
)

ActionChains(driver).move_to_element(captcha_iframe).click().perform()

# click im not robot
captcha_box = WebDriverWait(driver, 10).until(
    ec.presence_of_element_located(
        (
            By.ID, 'g-recaptcha-response'
        )
    )
)

driver.execute_script("arguments[0].click()", captcha_box)