English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Français · Español · Русский · العربية
Introduction
shirabe is a lightweight, Rust-native browser automation library and debug server. It drives any browser that speaks the Chrome DevTools Protocol — Google Chrome, Chromium, Microsoft Edge — through one hand-rolled CDP engine, and exposes the whole thing over a small HTTP API. It is the browser backbone extracted from the tairitsu packager, hardened to stand on its own.
The guiding idea is the same as ort for ONNX Runtime: you should never have to install a browser by hand. A pinned Chrome for Testing build is fetched into a shared cache at build time (or on first use), located transparently, and driven through CDP. Pin a different backend, ship native libs with your product, route the download through a mirror or proxy — all from environment variables.
Quick Start
CLI
# Zero-config: auto-discovers Chrome/Chromium/Edge, or fetches Chrome for Testing.
# Pin a backend, route the browser through a proxy.
SHIRABE_BACKEND=chromium
# Then drive it over HTTP.
Library
use ;
async
Backends & zero-config resolution
Pick a backend with SHIRABE_BACKEND=chrome|chromium|edge|firefox|servo|auto
(default auto). The Chromium family (Chrome / Chromium / Edge) is driven
in-process through our own CDP engine; Firefox and Servo take a
different path — their cores are built by the browser vendors and shipped as
dynamic libraries, which shirabe drives through a thin C-binding FFI contract
(the foreign-engine feature, see
Foreign Engines). Whichever is chosen,
shirabe resolves it in this order:
- Backend-specific override —
CHROME_PATH/CHROMIUM_PATH/EDGE_PATH. - Build-time baked path —
SHIRABE_BROWSER_PATH, emitted bybuild.rswhen theauto-fetchfeature downloads Chrome for Testing during the build. - System binary on
$PATHand well-known install locations. - Runtime fetch (the
runtime-fetchfeature) — download the pinned build into the shared cache.
Download knobs (build time and runtime alike):
| Env | Purpose |
|---|---|
SHIRABE_CHROME_VERSION |
Override the pinned Chrome for Testing version. |
SHIRABE_CHROME_MIRROR |
Download from a mirror instead of storage.googleapis.com. |
SHIRABE_CHROME_SHA256 |
Optional hex checksum to verify the download. |
SHIRABE_DOWNLOAD_PROXY |
Route the download through http:// / https:// / socks5:// proxy. |
SHIRABE_DOWNLOAD_TIMEOUT_SECS |
Per-request timeout (default 600). |
SHIRABE_SKIP_BROWSER_FETCH |
Skip both build-time and runtime downloads. |
SHIRABE_BACKEND |
Which Chromium-family backend to drive. |
Shipping native libraries with your product
A fetched Chrome build (and your own crate) depend on native libraries that a clean container may lack. shirabe gives packagers two tools:
-
Declarative bundle — list the
.so/.dylib/.dllfiles to ship viaSHIRABE_BUNDLE_LIBS(path-sep list) orSHIRABE_BUNDLE_MANIFEST(abundle.tomlof[[lib]]tables). Example manifest:[[]] = "third_party/libfoo.so" = true = "linux" [[]] = "third_party/foo.dll" -
Dependency scan —
shirabe::collect_runtime_deps(exe)enumerates the shared libraries a binary links against (ldd/otool -L/ a PE import scan), andshirabe::render_bundle_report(&BundleReport::build(&exe))prints everything a release script should copy alongside the binary.
use ;
let report = build;
print!;
HTTP API
| Method | Path | Description |
|---|---|---|
GET |
/health |
Server health |
GET |
/info |
Browser status + selected backend |
POST |
/navigate |
Navigate to a URL |
POST |
/click |
Click an element |
POST |
/type |
Type text |
POST |
/evaluate |
Execute JavaScript |
POST |
/screenshot |
Capture a screenshot |
POST |
/wait-for-selector |
Wait for an element |
GET |
/dom |
Query the DOM |
GET |
/a11y |
Accessibility tree |
POST |
/batch |
Batch operations |
…plus console, network and websocket capture endpoints for full control.
Development
SHIRABE_SKIP_BROWSER_FETCH=1
SHIRABE_SKIP_BROWSER_FETCH=1
License
SySL-1.0 (Synthetic Source License). See LICENSE.