How to Use DeathByCaptcha with Puppeteer for Browser Automation

How to Use DeathByCaptcha with Puppeteer for Browser Automation

Posted on 2026-07-17 | Category: guides


How to Use DeathByCaptcha with Puppeteer for Browser Automation

Puppeteer is the leading browser automation library for Node.js, commonly used for web scraping, testing, and monitoring. When automated Puppeteer scripts hit CAPTCHA walls, integrating a puppeteer captcha solver keeps your workflows running.

This guide shows how to connect Puppeteer with DeathByCaptcha using Node.js.

Prerequisites

  • Node.js 16+
  • A DeathByCaptcha account (free trial)
  • Puppeteer installed (npm install puppeteer)

Step 1: Install the DBC Node.js Client

npm install deathbycaptcha

Step 2: Connect to DBC

const DBC = require('deathbycaptcha');
const client = new DBC.SocketClient('username', 'password');

Step 3: Detect and Solve CAPTCHAs

const puppeteer = require('puppeteer');

async function solveCaptcha(page) {
    const screenshot = await page.screenshot({ encoding: 'base64' });
    const result = await client.decode(
        Buffer.from(screenshot, 'base64'), 60
    );
    if (result.text) {
        await page.type('#captcha-input', result.text);
        await page.click('#submit-button');
    }
}

(async () => {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('https://example.com');
    const captchaPresent = await page.$('#captcha-image');
    if (captchaPresent) await solveCaptcha(page);
    await browser.close();
})();

Step 4: Handling reCAPTCHA with Puppeteer

For reCAPTCHA v2, capture the site key and page URL, then use DBC's endpoint:

const result = await client.decode({
    googlekey: 'SITE_KEY',
    pageurl: 'https://example.com'
}, 60, 4);

Inject the token back into the page:

await page.evaluate((token) => {
    document.getElementById('g-recaptcha-response').innerHTML = token;
}, result.text);

Best Practices

  • Use DBC's callback mode for high-volume workflows.
  • Implement exponential backoff for captcha retries.
  • Rotate user agents and viewport sizes to reduce detection.
  • Monitor your DBC balance programmatically.

Next Steps



حالة: OK

تعمل الخوادم بشكل كامل مع وقت استجابة أسرع من المتوسط.
  • متوسط وقت الحل
  • 1 ثواني - Normal CAPTCHAs (1 دقيقة. منذ)
  • 16 ثواني - reCAPTCHA V2, V3 (1 دقيقة. منذ)
  • 18 ثواني - آحرون (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