You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用element_to_be_clickable点击reCAPTCHA报错,请求技术协助

解决reCAPTCHA点击报错问题

错误原因

报错'element_to_be_clickable() takes 1 positional argument but 2 were given'的核心问题是参数传递错误:EC.element_to_be_clickable()要求接收一个元组格式的定位参数(定位策略+定位表达式),而你直接传入了两个独立参数,导致参数数量不匹配。

修正代码

将定位参数打包成元组传入即可解决:

checkbox = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="recaptcha-anchor"]')))
checkbox.click()

补充说明

  • 确保已导入所有依赖模块:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
  • reCAPTCHA是Google的反自动化验证机制,即使代码修正,仍可能触发人机验证,此时自动化脚本无法绕过,需要手动完成验证。

内容的提问来源于stack exchange,提问作者Sumanto

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 13:23:17