{"id":34617336,"url":"https://github.com/padamson/playwright-rust","last_synced_at":"2026-05-24T00:03:30.817Z","repository":{"id":322697407,"uuid":"1090382961","full_name":"padamson/playwright-rust","owner":"padamson","description":"Rust language bindings for Microsoft Playwright","archived":false,"fork":false,"pushed_at":"2026-05-23T13:10:05.000Z","size":1967,"stargazers_count":98,"open_issues_count":7,"forks_count":13,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-23T14:25:20.804Z","etag":null,"topics":["browser-automation","playwright","playwright-tests","rust","testing"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/playwright-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/padamson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-05T15:40:06.000Z","updated_at":"2026-05-23T13:10:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/padamson/playwright-rust","commit_stats":null,"previous_names":["padamson/playwright-rust"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/padamson/playwright-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padamson%2Fplaywright-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padamson%2Fplaywright-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padamson%2Fplaywright-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padamson%2Fplaywright-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/padamson","download_url":"https://codeload.github.com/padamson/playwright-rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/padamson%2Fplaywright-rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33415020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T22:14:44.296Z","status":"ssl_error","status_checked_at":"2026-05-23T22:14:43.778Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-automation","playwright","playwright-tests","rust","testing"],"created_at":"2025-12-24T14:49:56.731Z","updated_at":"2026-05-24T00:03:30.811Z","avatar_url":"https://github.com/padamson.png","language":"Rust","funding_links":[],"categories":["Language Support"],"sub_categories":[],"readme":"# Playwright for Rust\n\n[![crates.io](https://img.shields.io/crates/v/playwright-rs.svg)](https://crates.io/crates/playwright-rs)\n[![docs.rs](https://docs.rs/playwright-rs/badge.svg)](https://docs.rs/playwright-rs)\n[![CI](https://github.com/padamson/playwright-rust/actions/workflows/test.yml/badge.svg)](https://github.com/padamson/playwright-rust/actions/workflows/test.yml)\n[![License](https://img.shields.io/crates/l/playwright-rs)](LICENSE)\n[![Playwright](https://img.shields.io/badge/Playwright-1.60.0-45ba4b)](https://playwright.dev)\n\n\u003e Rust language bindings for [Microsoft Playwright](https://playwright.dev) — the industry standard for cross-browser end-to-end testing.\n\n**Status:** Pre-1.0, API stabilizing. See [coverage](#coverage) for the path to v1.0.\n\n\u003e This README describes the latest published release on crates.io. For changes\n\u003e on `main` that haven't been released yet (new features, breaking changes,\n\u003e bug fixes), see [`crates/playwright/CHANGELOG.md`](crates/playwright/CHANGELOG.md)\n\u003e under `[Unreleased]`.\n\n## 🎯 Why playwright-rust?\n\nRead our [WHY.md](WHY.md) to understand the vision, timing, and philosophy behind this project.\n\n**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.\n\n## Roadmap and Goals\n\nSee [Development Roadmap](docs/roadmap.md) for plans and status of the development approach for `playwright-rust`.\n\n**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](https://github.com/microsoft/playwright-python), [playwright-java](https://github.com/microsoft/playwright-java), and [playwright-dotnet](https://github.com/microsoft/playwright-dotnet).\n\n## Quick Comparison: Python vs Rust\n\nThe API matches Playwright's cross-language conventions — if you know playwright-python, you know playwright-rust:\n\n\u003ctable\u003e\n\u003ctr\u003e\u003cth\u003ePython\u003c/th\u003e\u003cth\u003eRust\u003c/th\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\n\n```python\nfrom playwright.sync_api import sync_playwright\n\nwith sync_playwright() as p:\n    browser = p.chromium.launch()\n    page = browser.new_page()\n    page.goto(\"https://example.com\")\n\n    # Locator with auto-waiting\n    heading = page.locator(\"h1\")\n    assert heading.text_content() == \"Example Domain\"\n\n    # Response body access\n    resp = page.goto(\"https://api.example.com/data\")\n    data = resp.json()\n\n    browser.close()\n```\n\n\u003c/td\u003e\u003ctd\u003e\n\n```rust\nuse playwright_rs::Playwright;\n\nlet pw = Playwright::launch().await?;\nlet browser = pw.chromium().launch().await?;\nlet page = browser.new_page().await?;\npage.goto(\"https://example.com\", None).await?;\n\n// Locator with auto-waiting\nlet heading = page.locator(\"h1\").await;\nassert_eq!(heading.text_content().await?, Some(\"Example Domain\".into()));\n\n// Response body access\nlet resp = page.goto(\"https://api.example.com/data\", None).await?.unwrap();\nlet data: serde_json::Value = resp.json().await?;\n\nbrowser.close().await?;\n```\n\n\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n## Coverage\n\n**Full Python API parity + agent integration.** All Playwright Python\nclasses and methods are implemented, plus `Browser::bind()` /\n`Browser::unbind()` (Playwright 1.59) for exposing a Rust-launched browser\nto external clients like `@playwright/mcp`, the Playwright CLI, or\nthird-party agent tooling.\n\nThe remaining path to v1.0 is multi-month dogfooding, API polish, and\nperformance tuning rather than new surface area. See the\n[v1.0 gap analysis](docs/implementation-plans/v1.0-gap-analysis.md) for\nthe detailed state of each class.\n\n## How It Works\n\n`playwright-rust` follows Microsoft's proven architecture for language bindings:\n\n```\n┌──────────────────────────────────────────────┐\n│ playwright-rs (Rust API)                     │\n│ - High-level, idiomatic Rust API             │\n│ - Async/await with tokio                     │\n│ - Type-safe bindings                         │\n└─────────────────────┬────────────────────────┘\n                      │ JSON-RPC over stdio\n┌─────────────────────▼────────────────────────┐\n│ Playwright Server (Node.js/TypeScript)       │\n│ - Browser automation logic                   │\n│ - Cross-browser protocol abstraction         │\n│ - Maintained by Microsoft Playwright team    │\n└─────────────────────┬────────────────────────┘\n                      │ Native protocols\n        ┌─────────────┼─────────────┐\n        ▼             ▼             ▼\n    Chromium      Firefox       WebKit\n```\n\nThis means:\n- ✅ **Full feature parity** with Playwright (JS/Python/Java/.NET)\n- ✅ **Cross-browser support** (Chromium, Firefox, WebKit)\n- ✅ **Automatic updates** when Playwright server updates\n- ✅ **Minimal maintenance** - protocols handled by Microsoft's server\n- ✅ **Production-tested** architecture used by millions\n\n### API Design Philosophy\n\nFollowing Playwright's cross-language consistency:\n\n1. **Match Playwright API exactly** - Same method names, same semantics\n2. **Idiomatic Rust** - Use Result\u003cT\u003e, async/await, builder patterns where appropriate\n3. **Type safety** - Leverage Rust's type system for compile-time safety\n4. **Auto-waiting** - Built-in smart waits like other Playwright implementations\n5. **Testing-first** - Designed for reliable end-to-end testing\n\n## Installation\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\nplaywright-rs = \"0.13\"  # Auto-updates to latest 0.13.x\ntokio = { version = \"1\", features = [\"full\"] }\n```\n\nThe default-on `macros` feature re-exports the\n[`locator!()`](https://docs.rs/playwright-rs-macros) compile-time\nselector macro. Opt-in features: `cli` (installer binary, see below),\n`screenshot-diff` (pixel-diff assertions). For programmatic trace-zip\ninspection (CI bots, agent feedback loops), add\n[`playwright-rs-trace`](https://docs.rs/playwright-rs-trace) as a\n`[dev-dependencies]` entry.\n\nSee the [CHANGELOG](CHANGELOG.md) for version history and features.\n\n### Browser Installation (Required)\n\nBrowsers must be installed before use. Install once, then run tests as many times as needed.\n\n```bash\n# Install all browsers\nnpx playwright@1.60.0 install\n\n# Or install specific browsers\nnpx playwright@1.60.0 install chromium firefox webkit\n```\n\n**In CI/CD:** Add this to your GitHub Actions workflow:\n\n```yaml\n- name: Install Playwright Browsers\n  run: npx playwright@1.60.0 install chromium firefox webkit --with-deps\n```\n\n**Programmatic installation:** For setup scripts, Docker images, or tools built on playwright-rs, you can install browsers from Rust code:\n\n```rust\nuse playwright_rs::install_browsers;\n\ninstall_browsers(None).await?;                          // all browsers\ninstall_browsers(Some(\u0026[\"chromium\"])).await?;            // specific browsers\n```\n\n**Why version matters:** The library bundles Playwright driver **1.60.0**. Each release expects specific browser builds. Using the matching version ensures compatible browsers.\n\n**What happens if I don't install browsers?** You'll get a helpful error message with the correct install command when trying to launch a browser.\n\n## Development\n\n### Prerequisites\n\n- Rust 1.88+\n- Node.js 18+ (for Playwright server and browser installation)\n- tokio async runtime\n\n### Building from Source\n\n```bash\n# Clone repository\ngit clone https://github.com/YOUR_USERNAME/playwright-rust.git\ncd playwright-rust\n\n# Install pre-commit hooks\npip install pre-commit\npre-commit install\n\n# Build\ncargo build\n```\n\n### Installing Browsers\n\nAfter building, install browsers as described in [Browser Installation](#browser-installation-required) above:\n\n```bash\ncargo build\nnpx playwright@1.60.0 install chromium firefox webkit\n```\n\nThe build script automatically downloads the Playwright driver to `drivers/` (gitignored). CI handles browser installation automatically - see `.github/workflows/test.yml`.\n\n**Platform Support:** ✅ Windows, macOS, Linux\n\n**Known limitation**: WebKit `launch_persistent_context()` fails on native\nWindows with \"Initial load failed\" — this is an upstream Playwright issue\n([microsoft/playwright#36936](https://github.com/microsoft/playwright/issues/36936),\nalso tracked as playwright-rust [#39](https://github.com/padamson/playwright-rust/issues/39)).\nMicrosoft is building a `channel: \"webkit-wsl\"` replacement\n([microsoft/playwright#37036](https://github.com/microsoft/playwright/issues/37036)).\nChromium and Firefox persistent contexts work on all platforms. Non-persistent\nWebKit (`browser.new_context()`) works on Windows. Use WSL or macOS/Linux for\nWebKit persistent contexts.\n\n### Running Tests\n\nThis project uses [cargo-nextest](https://nexte.st/). Install once: `cargo install cargo-nextest`\n\n```bash\ncargo nextest run                                    # All tests\ncargo nextest run -p playwright-rs --lib             # Unit tests only (~2s, no browsers)\ncargo nextest run -p playwright-rs -E 'test(locator)' # Pattern match\ncargo test --doc --workspace -- --ignored            # Doc-tests (requires browsers)\n```\n\n### Running Examples\n\nSee [examples/](crates/playwright/examples/) for usage examples.\n\n```bash\ncargo run --package playwright-rs --example basic\n```\n\n## Testing \u0026 Debugging\n\n**See the source line that failed.** When `?` propagates an `Error` out of\nyour test, you see the message but no Rust source location. Use\n[`anyhow`](https://docs.rs/anyhow) for tests and run with `RUST_BACKTRACE=1`:\n\n```rust,ignore\nuse anyhow::{Context, Result};\n\n#[tokio::test]\nasync fn my_test() -\u003e Result\u003c()\u003e {\n    // ...\n    let content = heading.text_content().await.context(\"read heading\")?;\n    // ...\n    Ok(())\n}\n```\n\nRun as `RUST_BACKTRACE=1 cargo nextest run` (or `cargo test`). The backtrace\npoints at the failing `?`, and `.context(\"...\")` adds breadcrumbs to the\nerror chain. This matches how playwright-java/dotnet rely on the test\nrunner's stack trace rather than baking source locations into the library.\n\n**Save a Playwright trace when a test fails.** Rust has no async `Drop`,\nso trace cleanup is explicit. Capture the test result, then run cleanup\nunconditionally and pass the trace path only on failure:\n\n```rust,ignore\nlet result = run_test_body(\u0026context).await;\nlet trace_path = result.is_err().then(|| \"trace.zip\".to_string());\nlet _ = tracing.stop(Some(TracingStopOptions { path: trace_path })).await;\nlet _ = browser.close().await;\nresult?;\n```\n\nSee [`examples/trace_on_failure.rs`](crates/playwright/examples/trace_on_failure.rs)\nfor a runnable end-to-end example. Open the resulting `trace.zip` at\n\u003chttps://trace.playwright.dev\u003e.\n\n## Using with Claude Code / AI agents\n\nIf you're writing playwright-rs tests with Claude Code or another\ncoding agent, two artifacts in this repo are designed to be copied\ninto your downstream project so the agent has the right API model\nloaded:\n\n- [**`docs/agent/CLAUDE_SNIPPET.md`**](docs/agent/CLAUDE_SNIPPET.md) —\n  a ~50-line section to paste into your project's `CLAUDE.md`. Covers\n  the object model, conventions (builder pattern, `locator!()`,\n  auto-wait), and the trace-on-failure pattern. Zero-friction install:\n  one paste.\n- [**`.claude/skills/playwright-rs-usage/`**](.claude/skills/playwright-rs-usage/) —\n  the same content in skill form (auto-loads when the trigger\n  description matches the user's request). Install with\n  `cp -r path/to/playwright-rust/.claude/skills/playwright-rs-usage your-project/.claude/skills/`.\n\nBoth point back at [docs.rs](https://docs.rs/playwright-rs) and the\n[examples](crates/playwright/examples/) for the API surface itself —\nthey're a thin \"what to reach for, what to avoid\" overlay rather than\na duplicate of the API reference.\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=padamson/playwright-rust\u0026type=Date)](https://star-history.com/#padamson/playwright-rust\u0026Date)\n\n## Contributing\n\nThis project aims for **production-quality** Rust bindings matching Playwright's standards. Contributions should:\n\n- Follow Playwright API conventions\n- Include comprehensive tests\n- Maintain type safety\n- Document public APIs with examples\n- Pass CI checks (fmt, clippy, tests)\n\n## License\n\nApache-2.0 (same as Microsoft Playwright)\n\n## Acknowledgments\n\n- **Microsoft Playwright Team** - For the amazing browser automation framework\n- **playwright-python** - API design reference\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpadamson%2Fplaywright-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpadamson%2Fplaywright-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpadamson%2Fplaywright-rust/lists"}