Skip to main content
The Captcha namespace provides automatic captcha detection and solving for any active session. It supports reCAPTCHA, hCaptcha, Turnstile, and other common captcha types. Simply call detect() to find captchas or solve() to detect and solve them in one step. The same operations are also exposed over HTTP via POST /v1/sessions/{id}/automation using call='page.captcha.detect' and call='page.captcha.solve'.

Access

import { Bctrl } from '@bctrl/sdk/all';
const bctrl = new Bctrl({ apiKey: process.env.BCTRL_API_KEY! });
const connected = await bctrl.session.playwright();
// captcha methods available on connected session
await connected.captcha.solve();

Quick Example

import { Bctrl } from '@bctrl/sdk/all';
const bctrl = new Bctrl({ apiKey: process.env.BCTRL_API_KEY! });

const connected = await bctrl.session.playwright();

// Navigate to a page with a captcha
await connected.page.goto('https://example.com/login');

// Detect captchas on the page
const detection = await connected.captcha.detect();
if (detection.found) {
  console.log('Found captchas:', detection.captchas);
}

// Or detect and solve in one step
const result = await connected.captcha.solve();
if (result.success) {
  console.log(`Solved ${result.type} in ${result.duration}ms`);
}

Methods

detect()

Detect captchas on the current page without solving them. Returns information about any captchas found, including their type and location.
options
CaptchaDetectArgs
Detection options.
result
CaptchaDetectResult
Detection result with captcha information.
const result = await connected.captcha.detect();
if (result.found) {
  for (const c of result.captchas) {
    console.log(c.type, c.selector);
  }
}

solve()

Detect and solve a captcha on the current page. Automatically identifies the captcha type, sends it to the solver backend, and injects the solution token.
options
CaptchaSolveArgs
Solve options.
result
CaptchaSolveResult
Solve result with success status and timing.
const result = await connected.captcha.solve();
if (result.success) {
  console.log(`Solved ${result.type} in ${result.duration}ms`);
}