Skip to main content

Crate zendriver_cloudflare

Crate zendriver_cloudflare 

Source
Expand description

Cloudflare Turnstile bypass for zendriver.

See the Cloudflare chapter of the zendriver-rs user guide for end-to-end usage, timeout tuning, and detection-failure diagnostics.

Drives the Turnstile checkbox click flow:

  1. Detect the Turnstile iframe via a shadow-DOM-aware walk of the page’s main world.
  2. Dispatch a raw left-click at the 15% × 50% offset inside the iframe bbox (the canonical Turnstile checkbox location).
  3. Poll for either the cf-turnstile-response input gaining a token, or the challenge container disappearing entirely.

Most users go through zendriver’s Tab::cloudflare() (feature-gated) rather than constructing the bypass directly. The CloudflareBypass type is the underlying driver.

use std::time::Duration;
use zendriver_cloudflare::{CloudflareBypass, ClearanceOutcome};

let outcome = CloudflareBypass::new(tab)
    .wait_for_clearance(Duration::from_secs(30))
    .await?;
match outcome {
    ClearanceOutcome::TokenAcquired(token) => println!("got token: {token}"),
    ClearanceOutcome::ChallengeGone => println!("challenge cleared"),
}

Re-exports§

pub use bypass::ClearanceOutcome;
pub use bypass::CloudflareBypass;
pub use error::CloudflareError;

Modules§

bypass
Cloudflare Turnstile bypass driver.
click
Raw mouse-click dispatch for the Turnstile checkbox.
detection
Shadow-DOM Turnstile challenge detection.
error
Cloudflare-bypass errors.