Selenium 验证码解算器集成

此页面帮助 Selenium 团队将验证码解决与测试和自动化管道的稳定、可重复工作流程集成。

Death By Captcha (DBC) 让 Selenium 脚本通过 API 解决验证码挑战,而无需手动交互:脚本从页面提取挑战参数、向 DBC 请求解答、将结果注入页面,然后继续流程。本页是快速入门:安装、可运行的代码示例以及受支持任务的说明。

安装

Python:

pip install selenium deathbycaptcha-official

在客户端中使用您的 DBC 账户凭据。运行流程前,请先创建账户并查看价格与余额。

代码示例:reCAPTCHA v2 令牌流程(Python + Selenium),改编自官方可运行示例。

import json
import os
import time

import deathbycaptcha
from selenium import webdriver
from selenium.webdriver.common.by import By

USERNAME = os.getenv('DBC_USERNAME')
PASSWORD = os.getenv('DBC_PASSWORD')
DEMO_URL = 'https://www.google.com/recaptcha/api2/demo'

def solve_recaptcha_v2(driver):
    # 1. extract the challenge parameters from the page
    sitekey = driver.find_element(By.ID, 'recaptcha-demo').get_attribute('data-sitekey')
    token_params = json.dumps({'googlekey': sitekey, 'pageurl': DEMO_URL})

    client = deathbycaptcha.SocketClient(USERNAME, PASSWORD)
    if client.get_balance() <= 0:
        raise SystemExit('No balance - top up before solving.')

    # 2. request the solution token from DBC (type 4 = reCAPTCHA v2 token)
    result = client.decode(type=4, token_params=token_params)
    return result['text'] if result else None

driver = webdriver.Firefox()
driver.get(DEMO_URL)

token = solve_recaptcha_v2(driver)
if not token:
    print('No solution yet - retry with backoff')
    raise SystemExit(1)


# 3. inject the token back into the page
driver.execute_script("document.getElementById('g-recaptcha-response').value = arguments[0]", token)

# 4. submit and wait for the success element
driver.find_element(By.ID, 'recaptcha-demo-submit').click()
time.sleep(2)
print(driver.find_element(By.CLASS_NAME, 'recaptcha-success').text)
driver.quit()

完整可运行版本: 官方 Python 客户端仓库中的 examples/deathbycaptcha-python-selenium

Selenium 团队通常遇到困难的地方

  • Flaky 解决了导致间歇性测试失败的问题。
  • 跨环境的挑战处理不一致。
  • 高并发下的弱重试和超时策略。

Selenium 积分矩阵

需要 Selenium 上下文 DBC路径
稳定的代币工作流程 重复自动化运行中的确定性处理。 API 驱动的令牌流具有明确的重试/时间限制。
类型覆盖范围 不同的项目有不同的挑战类别。 使用特定于类型的端点并分别验证每个场景。
运营支持 生产问题需要快速诊断。 用于升级和规划的支持和可靠性表面。

受支持任务说明

主题 说明
验证码类型(API) reCAPTCHA v2 和 v3、Cloudflare Turnstile、GeeTest、DataDome,以及图片/文字验证码。
流程 从页面提取 sitekey,向 DBC API 请求令牌(type 4),注入页面并提交表单。
余额 解答从账户余额中扣费;解码前请检查余额。
重试 未返回解答表示临时情况:请像官方示例那样以退避方式重试。
API 与扩展 此流程在脚本内使用 API;浏览器扩展是用于手动浏览的免代码路径。
支持的浏览器 任何支持 WebDriver 的浏览器;官方示例在 Firefox 和 Chrome 上运行。

下一步实施

对于 Selenium 验证码求解器部署,首先确认稳定的代币流,然后连接可靠性和定价页面以最终确定生产计划。


状态: OK

服务器以比平均响应时间更快的速度全面运行。
  • 平均求解时间
  • 4 秒 - Normal CAPTCHAs (1分钟。前)
  • 16 秒 - reCAPTCHA V2, V3 (1分钟。前)
  • 14 秒 - 其他的 (1分钟。前)
Chrome and Firefox logos
可用的浏览器扩展名

更新

  1. May 13: Crypto payments got better! You can now purchase your CAPTCHAs using cryptocurrency through the Hekelet payment processor at https://deathbycaptcha.com/user-pay and receive an extra 20% FREE CAPTCHA credit with every package purchased this way.
  2. Apr 15: GitHub Updates: We’ve upgraded our libraries, expanded sample code, enhanced documentation, and added support for C++ and Go, making integration smoother than ever. Explore what’s new at github.com/deathbycaptcha!
  3. Jan 27: RESOLVED - If your email to one of our official addresses ([email protected], [email protected], or [email protected]) has bounced or you haven’t received a response, please try resending it or reach out via our Live Chat Support at https://deathbycaptcha.com/es/contact.

  4. 之前的更新…

支持

我们的系统设计为完全用户友好且易于使用。如果您有任何问题,只需发送电子邮件至DBC 技术支持电子邮件com,支持代理将尽快与您联系。

现场支持

周一至周五可用(美国东部标准时间上午 10 点至下午 4 点) Live support image. Link to live support page