Skip to main content

Crate eoka

Crate eoka 

Source
Expand description

§Eoka

Stealth browser automation for Rust — a Puppeteer/Playwright alternative that bypasses bot detection.

Eoka is a minimal, fast headless Chrome library built from scratch. Unlike Selenium or chromiumoxide, it uses a custom CDP implementation with stealth filtering to avoid detection by Cloudflare, DataDome, PerimeterX, and other anti-bot systems.

§Features

  • Stealth by Default - Binary patching, 15 JS evasions, human-like mouse/typing
  • Puppeteer-like API - click(), type(), wait_for(), screenshot(), etc.
  • Direct CDP Transport - No separate WebDriver server or browser-driver dependency
  • AI-Agent Ready - PageState introspection, element indexing, text extraction
  • Fast - Lazy evasion scripts, mmap patching, stack-allocated paths

§Quick Start

use eoka::{ActionOptions, Browser, Expectation, LocatorSpec};

#[tokio::main]
async fn main() -> eoka::Result<()> {
    // Launch browser (patches Chrome, applies evasions)
    let browser = Browser::launch().await?;

    // Create page and navigate
    let page = browser.new_page("data:text/html,<input id=name><button onclick=\"document.body.dataset.done=1\">Save</button>").await?;

    // Human-like interactions
    page.fill("#name", "hello world").await?;
    let receipt = page.locator("button").click(ActionOptions::expecting(
        Expectation::Visible { target: LocatorSpec::css("body[data-done]") },
    )).await?;
    assert_eq!(receipt.outcome, eoka::ActionOutcome::VerifiedComplete);

    // Screenshot
    let png = page.screenshot().await?;
    std::fs::write("screenshot.png", png)?;

    browser.close().await?;
    Ok(())
}

§Configuration

use eoka::Browser;

// The default launch path is stealthy and headless.
let browser = Browser::launch().await?;
browser.close().await?;

// For one-off tweaks, mutate the default stealth config inline.
let browser = Browser::launch_with(|config| {
    config.proxy = Some("http://127.0.0.1:8080".into());
}).await?;
browser.close().await?;

Re-exports§

pub use action::Action;
pub use action::ActionOptions;
pub use action::ActionOutcome;
pub use action::ActionReceipt;
pub use action::DispatchObserver;
pub use action::DispatchState;
pub use action::Expectation;
pub use action::Locator;
pub use action::LocatorQuery;
pub use action::LocatorSpec;
pub use bounded_fetch::BoundedFetchRequest;
pub use bounded_fetch::BoundedFetchResponse;
pub use bounded_fetch::MAX_TEXT_FETCH_BYTES;
pub use browser::Browser;
pub use browser::TabInfo;
pub use download::DownloadBeginning;
pub use download::DownloadEvent;
pub use download::DownloadProgress;
pub use download::DownloadWatch;
pub use download::NativeDownloadState;
pub use element::BoundingBox;
pub use element::Element;
pub use error::Error;
pub use error::Result;
pub use fetch::BrowserFetchOutcome;
pub use fetch::BrowserFetchRequest;
pub use fetch::BrowserFetchResponse;
pub use network::NetworkEvent;
pub use network::NetworkWatcher;
pub use page::CaptureBodyError;
pub use page::CapturedFrameResponse;
pub use page::FrameResponseCapture;
pub use page::FrameResponseCaptureOptions;
pub use page::FrameResponseCaptureReport;
pub use page::CapturedRequest;
pub use page::FrameInfo;
pub use page::MouseButton;
pub use page::Page;
pub use page::PageState;
pub use page::ResponseBody;
pub use page::TextMatch;
pub use page::ScreenshotClip;
pub use page::ScreenshotFormat;
pub use page::ScreenshotOptions;
pub use session::BrowserSession;
pub use session::BrowserState;
pub use session::SessionCookie;
pub use stealth::Fingerprint;
pub use stealth::HumanSpeed;

Modules§

action
Deadline-bounded actions with explicit, observable completion conditions.
bounded_fetch
Bounded text inspection through the active browser session.
browser
Browser Launcher
cdp
Minimal CDP (Chrome DevTools Protocol) Client
download
Native browser download events. File placement and job policy belong to callers.
element
Element Abstraction
error
Error types for eoka
fetch
Browser-side fetch helpers.
network
Network Request Capture
page
Page Abstraction
session
Session export for browser-to-HTTP-client handoff
stealth
Stealth Layer

Structs§

NativeRecording
Owned target-bound recorder. Stop, read to EOF, then close to release Chrome’s temporary stream storage. Dropping schedules bounded best-effort cancellation. No file policy, transcoding, fallback engine, or whole-video buffering is used.
NativeRecordingOptions
Options for Chrome’s experimental native screen recorder (without audio).
RecordingChunk
A bounded decoded stream chunk. The final chunk may contain bytes and EOF.
StealthConfig
Configuration for stealth features

Enums§

RecordingError
Native recording failures, including uncertain native cleanup.