Lightweight browser automation for Starpod via Chrome DevTools Protocol.
This crate provides [BrowserSession], a high-level async interface for
controlling a CDP-speaking browser (Lightpanda or headless Chromium). It
uses direct CDP over WebSocket and handles process lifecycle, connection
management, and common browser operations.
Architecture
┌────────────────────┐ CDP/WebSocket ┌──────────────────────┐
│ BrowserSession │ ◄──────────────────── │ lightpanda serve │
│ (async-tungstenite)│ │ (auto-spawned) │
└────────────────────┘ └──────────────────────┘
Usage modes
-
Auto-spawn (recommended): [
BrowserSession::launch()] finds a free port, spawnslightpanda serve, waits for CDP readiness, and connects. The process is killed onclose()or [Drop]. -
External: [
BrowserSession::connect()] attaches to a pre-existing CDP endpoint (e.g. headless Chromium started by the user or systemd).
Requirements
For auto-spawn mode, lightpanda is automatically downloaded and installed
to ~/.local/bin/ if not already on PATH. No manual setup is needed.
Example
# async