| Crates.io | pw-rs |
| lib.rs | pw-rs |
| version | 0.11.1 |
| created_at | 2026-01-05 12:58:21.252448+00 |
| updated_at | 2026-01-05 13:07:12.23223+00 |
| description | Rust bindings for Microsoft Playwright |
| homepage | |
| repository | https://github.com/Alb-O/pw-rs |
| max_upload_size | |
| id | 2023782 |
| size | 940,764 |
Rust bindings for Playwright. Spawns the Playwright Node.js server as a subprocess and communicates over JSON-RPC stdio.
pw-core - Library: Playwright client, protocol types, browser/context/page abstractionspw-cli - CLI tool for browser automation without writing Rust[dependencies]
pw-core = "0.10"
tokio = { version = "1", features = ["full"] }
use pw_core::Playwright;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let pw = Playwright::launch().await?;
let browser = pw.chromium().launch().await?;
let page = browser.new_context().await?.new_page().await?;
page.goto("https://example.com").await?;
println!("Title: {}", page.title().await?);
browser.close().await?;
Ok(())
}
# Install
nix profile install .# # or: cargo install --path crates/pw-cli
# Basic usage
pw nav https://example.com
pw text h1
pw click "button.submit"
pw fill "input[name=email]" "user@example.com"
pw screenshot -o page.png
pw eval "document.title"
# Connect to existing browser (Chrome with --remote-debugging-port=9222)
pw connect ws://127.0.0.1:9222/devtools/browser/...
# Session context persists between commands
pw nav https://example.com # opens browser, saves context
pw text h1 # reuses same page
pw click ".next" # still same session
use scripts/pw.nu
use scripts/higgsfield.nu *
pw nav "https://example.com"
pw text "h1"
pw fill "input[name=q]" "search query"
# Site-specific workflows
higgsfield create-image "A dragon in a cyberpunk city"
nix develop # Shell with all deps (Playwright, Node.js, browsers)
cargo build --workspace
cargo test --workspace
nix build .# # Wrapped binary with Playwright runtime
Apache-2.0