cdp-browser-lite
Total lifecycle control for Chrome instances, seamlessly integrating with cdp-lite.
Overview
cdp-browser-lite provides the ability to spawn, attach, and manage Google Chrome or Chromium instances, ensuring correct cleanup, avoiding zombie processes, and offering a reliable interface for Headless Chrome automation.
It re-exports the complete interface of cdp-lite for convenient access to the Chrome DevTools Protocol.
Quickstart
use Browser;
use ;
async
Launch Modes
LaunchNew: Always spawns a new managed browser process.AttachOnly: Attaches to an already running instance.Auto: Tries to attach first, and if unavailable, launches a new instance.
Profile Modes
Ephemeral: Creates a temporary profile that is cleaned up when dropped.Persistent: Uses a persistent directory.UserDefault: Omits the profile flag, using the system's default Chrome profile.
Troubleshooting
- CHROME_PATH: Set
CHROME_PATHto specify a custom Chrome executable location. - Docker/Sandbox: If running in Docker, you may need to add
.no_sandbox(true)toBrowserConfigBuilder.
Supported Platforms
Every push and pull request is validated by CI, which lints (clippy, rustfmt),
builds and runs the full test suite on the three major operating systems, and then
proves the library links into runnable executables by building native binaries for
each target:
| OS | Target |
|---|---|
| Linux | x86_64-unknown-linux-gnu |
| macOS | aarch64-apple-darwin |
| macOS | x86_64-apple-darwin |
| Windows | x86_64-pc-windows-msvc |
Pushing a version tag (vX.Y.Z) triggers the release workflow, which packages the
compiled binaries for each platform and attaches them to the corresponding GitHub
Release.