Skip to main content

auto_solve

Function auto_solve 

Source
pub async fn auto_solve(page: &Page) -> Result<Option<CaptchaSolveResult>>
Expand description

One-call convenience: detect + solve in a single API.

Equivalent to:

let info = captchaforge::detect::detect(page).await?;
if !captchaforge::detect::is_captcha(&info) {
    return Ok(None);
}
let chain = captchaforge::solver::CaptchaSolverChain::default_chain();
Ok(Some(chain.solve(page, &info).await))

Returns:

  • Ok(None) — no captcha was detected on the page.
  • Ok(Some(result)) — captcha detected; result.success indicates whether the chain solved it. Failed solves still return Some so the caller can inspect the screenshot for human fallback.
  • Err(_) — the detection step itself failed (page eval error, CDP transport error). Solver errors are swallowed into a no-op CaptchaSolveResult and don’t surface here.

Power users that need a custom chain (telemetry, token cache, pattern store, custom solvers) construct their own solver::CaptchaSolverChain and call chain.solve() directly.

For a “navigate + solve in one call” entry point, see solve_url (re-exported from sdk).