How to Use DeathByCaptcha with Selenium: Step-by-Step Guide

How to Use DeathByCaptcha with Selenium: Step-by-Step Guide

Posted on 2026-07-17 | Category: guides


How to Use DeathByCaptcha with Selenium: Step-by-Step Guide

Selenium is the most widely used browser automation framework, and CAPTCHA challenges are one of the most common reasons Selenium scripts break in production. Integrating DeathByCaptcha's selenium captcha solver into your Selenium workflow takes only a few lines of code.

This guide walks through a complete integration using Python and the DBC API.

Prerequisites

  • Python 3.7+
  • A DeathByCaptcha account (free trial available)
  • Selenium installed (pip install selenium)
  • A WebDriver for your browser (ChromeDriver, GeckoDriver, etc.)

Step 1: Install the DBC Client

DBC provides an official Python client library:

pip install deathbycaptcha

Step 2: Set Up the DBC Client

import deathbycaptcha

username = "your_username"
password = "your_password"
client = deathbycaptcha.SocketClient(username, password)
client.is_verbose = True

Step 3: Capture and Solve a CAPTCHA

When your Selenium script encounters a CAPTCHA, capture the element and send it to DBC:

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

driver = webdriver.Chrome()
driver.get("https://example.com")

# When a CAPTCHA appears, capture the image
captcha_element = driver.find_element(By.CSS_SELECTOR, "#captcha-image")
captcha_element.screenshot("captcha.png")

# Send to DBC for solving
with open("captcha.png", "rb") as f:
    captcha_data = f.read()

captcha_id, solution = client.decode(captcha_data, timeout=60)
if solution:
    input_field = driver.find_element(By.CSS_SELECTOR, "#captcha-input")
    input_field.send_keys(solution)
    submit_button = driver.find_element(By.CSS_SELECTOR, "#submit")
    submit_button.click()

Step 4: Handling reCAPTCHA

For reCAPTCHA, use DBC's dedicated endpoint:

captcha_id, solution = client.decode(
    {"googlekey": "SITE_KEY", "pageurl": "https://example.com"},
    type=4
)

Best Practices

  • Reuse the DBC client connection instead of creating a new one for each captcha.
  • Set appropriate timeouts (15s for automated solves, 60s for human-assisted).
  • Handle errors gracefully with try/except blocks.
  • Use DBC's callback mode for high-throughput workflows.

Next Steps



Status: OK

Servers are fully operational with faster than average response time.
  • Average solving time
  • 1 seconds - Normal CAPTCHAs (1 min. ago)
  • 18 seconds - reCAPTCHA V2, V3 (1 min. ago)
  • 14 seconds - others (1 min. ago)
Chrome and Firefox logos
Browser extensions available

Updates

  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. Previous updates…

Support

Our system is designed to be completely user-friendly and easy-to-use. Should you have any trouble with it, simply email us at DBC technical support emailcom, and a support agent will get back to you as soon as possible.

Live Support

Available Monday to Friday (10am to 4pm EST) Live support image. Link to live support page