| Crates.io | playwright-rs |
| lib.rs | playwright-rs |
| version | 0.8.2 |
| created_at | 2025-11-14 12:07:38.836746+00 |
| updated_at | 2026-01-20 02:52:09.803524+00 |
| description | Rust bindings for Microsoft Playwright |
| homepage | |
| repository | https://github.com/padamson/playwright-rust |
| max_upload_size | |
| id | 1932688 |
| size | 1,091,086 |
🎭 Rust language bindings for Microsoft Playwright
Status: 🚧 Active Development - Not yet ready for production use
Read our WHY.md to understand the vision, timing, and philosophy behind this project.
TL;DR: Rust is emerging as a serious web development language, with frameworks like Axum and Actix gaining traction. AI coding assistants are making Rust accessible to more developers. Test-Driven Development is experiencing a renaissance as the optimal way to work with AI agents. These trends are converging now, and they need production-quality E2E testing. playwright-rust fills that gap by bringing Playwright's industry-leading browser automation to the Rust ecosystem.
See Development Roadmap for plans and status of the development approach for playwright-rust.
Goal: Build this library to a production-quality state for broad adoption as @playwright/rust or playwright-rs. Provide official-quality Rust bindings for Microsoft Playwright, following the same architecture as playwright-python, playwright-java, and playwright-dotnet.
playwright-rust follows Microsoft's proven architecture for language bindings:
┌──────────────────────────────────────────────┐
│ playwright-rs (Rust API) │
│ - High-level, idiomatic Rust API │
│ - Async/await with tokio │
│ - Type-safe bindings │
└─────────────────────┬────────────────────────┘
│ JSON-RPC over stdio
┌─────────────────────▼────────────────────────┐
│ Playwright Server (Node.js/TypeScript) │
│ - Browser automation logic │
│ - Cross-browser protocol abstraction │
│ - Maintained by Microsoft Playwright team │
└─────────────────────┬────────────────────────┘
│ Native protocols
┌─────────────┼─────────────┐
▼ ▼ ▼
Chromium Firefox WebKit
This means:
Following Playwright's cross-language consistency:
Add to your Cargo.toml:
[dependencies]
playwright-rs = "0.8" # Auto-updates to latest 0.8.x
tokio = { version = "1", features = ["full"] }
See the CHANGELOG for version history and features.
# Clone repository
git clone https://github.com/YOUR_USERNAME/playwright-rust.git
cd playwright-rust
# Install pre-commit hooks
pip install pre-commit
pre-commit install
# Build
cargo build
⚠️ IMPORTANT: Browsers are installed automatically after building the project!
When you run cargo build, the build script (build.rs) automatically:
drivers/playwright-1.56.1-<platform>/ in your workspace root~/.cache/playwright-rust/drivers/ on Linux/macOS)The build script uses robust workspace detection to find the right location automatically.
After building, install browsers using the downloaded driver's CLI:
# Build the project (downloads Playwright 1.56.1 driver)
cargo build
# Install browsers using the driver's CLI
# macOS/Linux:
drivers/playwright-1.56.1-*/node drivers/playwright-1.56.1-*/package/cli.js install chromium firefox webkit
# Windows:
drivers\playwright-1.56.1-win32_x64\node.exe drivers\playwright-1.56.1-win32_x64\package\cli.js install chromium firefox webkit
Platform-specific examples:
# macOS (arm64):
drivers/playwright-1.56.1-mac-arm64/node drivers/playwright-1.56.1-mac-arm64/package/cli.js install chromium firefox webkit
# macOS (x64):
drivers/playwright-1.56.1-mac/node drivers/playwright-1.56.1-mac/package/cli.js install chromium firefox webkit
# Linux:
drivers/playwright-1.56.1-linux/node drivers/playwright-1.56.1-linux/package/cli.js install chromium firefox webkit
Why this matters:
drivers/ directory is gitignored, so each developer/CI environment installs its ownPlatform Support:
Note: CI automatically installs the correct browser versions - see .github/workflows/test.yml
Verify installation:
# Browsers are cached in:
# macOS: ~/Library/Caches/ms-playwright/
# Linux: ~/.cache/ms-playwright/
# Windows: %USERPROFILE%\AppData\Local\ms-playwright\
ls ~/Library/Caches/ms-playwright/
# Should show: chromium-1194, chromium_headless_shell-1194, firefox-1495, webkit-2215
Note: This project uses cargo-nextest for faster test execution. Install it once globally:
cargo install cargo-nextest
# All tests (recommended - faster)
cargo nextest run
# All tests (standard cargo)
cargo test
# Integration tests only (requires browsers)
cargo nextest run --test '*'
# Specific test
cargo nextest run test_launch_chromium
# With logging
RUST_LOG=debug cargo nextest run
# Doc-tests (nextest doesn't run these)
# See CLAUDE.md "Documentation Testing Strategy" for details
# Compile-only check (fast, used in pre-commit)
cargo test --doc --workspace
# Execute all ignored doctests (requires browsers, what CI does)
cargo test --doc --workspace -- --ignored
# Execute specific crate's doctests
cargo test --doc -p playwright-rs -- --ignored
Note: See examples/ for usage examples.
# Run a single example
cargo run --package playwright-rs --example basic
# Run all examples
for example in crates/playwright/examples/*.rs; do
cargo run --package playwright-rs --example $(basename "$example" .rs) || exit 1
done
This project aims for production-quality Rust bindings matching Playwright's standards. Contributions should:
Apache-2.0 (same as Microsoft Playwright)