eoka
Stealth browser automation. Passes bot detection without the bloat.
Requirements
Chrome or Chromium must be installed. eoka launches and controls a real browser instance via CDP.
Install
[]
= "0.3"
= { = "1", = ["rt-multi-thread", "macros"] }
Quick Start
use ;
async
Real-World Example: Login Flow
use ;
async
What it does
Patches Chrome binary to remove $cdc_ and webdriver strings. Injects 15 evasion scripts before page load. Blocks detectable CDP commands (Runtime.enable, Debugger.enable, etc.) at the transport layer. Simulates human mouse movement with Bezier curves.
Passes: sannysoft, rebrowser bot detector (6/6), areyouheadless, browserleaks
Partial: creepjs (33% trust score - it's good at what it does)
API Reference
Finding Elements
// By CSS selector
let elem = page.find.await?;
let elems = page.find_all.await?;
// By text content (case-insensitive, prioritizes links/buttons)
let btn = page.find_by_text.await?;
let items = page.find_all_by_text.await?;
// Fallback chains - try multiple selectors
let email = page.find_any.await?;
// Check existence without error
if page.exists.await
if page.text_exists.await
Clicking
// By selector
page.click.await?;
page.human_click.await?; // with mouse movement
// By text
page.click_by_text.await?;
page.human_click_by_text.await?;
// Try-click: returns Ok(false) instead of error when not found
if page.try_click.await?
page.try_click_by_text.await?;
page.try_human_click.await?;
Form Filling
// fill() clears existing content before typing
page.fill.await?;
page.human_fill.await?; // with natural delays
// type_into() doesn't clear first (appends)
page.type_into.await?;
page.human_type.await?;
Waiting
// Wait for element by selector (in DOM)
page.wait_for.await?;
page.wait_for_hidden.await?;
// Wait for element to be VISIBLE and clickable (recommended before interaction)
page.wait_for_visible.await?;
// Wait for any of multiple selectors
page.wait_for_any.await?;
// Wait for element by text
page.wait_for_text.await?;
// Wait for URL changes
page.wait_for_url_contains.await?;
page.wait_for_url_change.await?;
// Wait for network to be idle (no pending requests)
page.wait_for_network_idle.await?; // 500ms idle, 30s timeout
// Fixed delay (use sparingly)
page.wait.await;
Element Inspection
let elem = page.find.await?;
// Visibility
elem.is_visible.await?; // Result<bool> - can we click it?
elem.bounding_box.await; // Option<BoundingBox>
// Attributes
elem.get_attribute.await?; // Option<String>
elem.tag_name.await?; // "button", "a", "input", etc.
// State
elem.is_enabled.await?; // not disabled
elem.is_checked.await?; // for checkboxes/radios
elem.value.await?; // input value
// Styling
elem.css.await?; // computed CSS value
// Actions
elem.scroll_into_view.await?;
Page Info
let url = page.url.await?;
let title = page.title.await?;
let html = page.content.await?;
let text = page.text.await?;
let png = page.screenshot.await?;
// Debug info
let state = page.debug_state.await?;
println!;
// Debug screenshot with timestamp
let filename = page.debug_screenshot.await?;
JavaScript
// Evaluate and get result
let count: i32 = page.evaluate.await?;
// Execute without return value
page.execute.await?;
// Execute inside an iframe
let title: String = page.evaluate_in_frame.await?;
Frames/Iframes
// List all frames
let frames = page.frames.await?;
for frame in frames
// Execute JavaScript inside iframe
let count: i32 = page.evaluate_in_frame.await?;
Retry Operations
// Retry flaky operations
page.with_retry.await?;
Multi-Tab
// Create multiple tabs
let page1 = browser.new_page.await?;
let page2 = browser.new_page.await?;
// List all open tabs
for tab in browser.tabs.await?
// Get page's tab ID
let id = page1.target_id;
// Focus a tab
browser.activate_tab.await?;
// Close a specific tab
browser.close_tab.await?;
File Uploads
// Single file
page.upload_file.await?;
// Multiple files
page.upload_files.await?;
Select / Dropdowns
// By value
page.select.await?;
// By visible text
page.select_by_text.await?;
// Multi-select
page.select_multiple.await?;
Hover (Reveal Menus)
// Hover to reveal dropdown menu
page.hover.await?;
page.click.await?;
// Human-like hover
page.human_hover.await?;
Keyboard Shortcuts
// Single keys
page.press_key.await?;
page.press_key.await?;
page.press_key.await?;
// With modifiers
page.press_key.await?; // Select all
page.press_key.await?; // Copy (Mac)
page.press_key.await?; // Save as
// Convenience methods
page.select_all.await?; // Ctrl+A / Cmd+A
page.copy.await?; // Ctrl+C / Cmd+C
page.paste.await?; // Ctrl+V / Cmd+V
Recipes
Handle Cookie Banners
// Try multiple common selectors
for selector in
// Or by text
page.try_click_by_text.await?;
Wait for Page After Click
// Wait for URL to change
page.human_click_by_text.await?;
page.wait_for_url_contains.await?;
// Or wait for specific content
page.human_click_by_text.await?;
page.wait_for_text.await?;
Handle Dynamic/AJAX Pages
page.human_click_by_text.await?;
page.wait_for_network_idle.await?; // Wait for XHR to complete
Fill Multi-Step Form
// Step 1: Personal info
page.human_fill.await?;
page.human_fill.await?;
page.human_click_by_text.await?;
// Step 2: Wait for next section to be visible, then fill
page.wait_for_visible.await?;
page.human_fill.await?;
page.human_click_by_text.await?;
Handle Login With Redirect
let page = browser.new_page.await?;
// If redirected to login
if page.text_exists.await
// Now on dashboard
page.wait_for_text.await?;
Robust Element Selection
// Use fallback chains for inconsistent pages
let email_input = page.find_any.await?;
// Or wait for any to appear
page.wait_for_any.await?;
Config
let config = StealthConfig ;
let browser = launch_with_config.await?;
// Or use presets
let browser = launch_with_config.await?;
let browser = launch_with_config.await?;
Error Handling
Eoka provides descriptive error messages:
// Element not visible (instead of cryptic CDP error)
// Error: Element not visible: '#hidden-btn' exists in DOM but is not rendered
// Timeout with context
// Error: Timeout: Element '#results' not visible within 10000ms
// Retry exhausted
// Error: Retry exhausted after 3 attempts: Element not found: #flaky-element
Examples
How it works
~5K lines of Rust. No chromiumoxide, no puppeteer-extra. Hand-written CDP types for the ~30 commands we actually need.
src/
├── cdp/ # websocket transport, command filtering
├── stealth/ # evasions, binary patcher, human simulation
├── browser.rs # chrome launcher
├── page.rs # page api
└── session.rs # cookie export
The key insight: most detection comes from CDP commands leaking (Runtime.enable fires consoleAPICalled events that pages can detect). We block those at the transport layer and define navigator properties on the prototype instead of the instance.
License
MIT