playhard-cdp 0.1.1

Typed Chrome DevTools Protocol helpers for the Playhard Rust browser automation stack.
Documentation

Playhard

Playhard is a minimal playright style library written in Rust. It is currently on active development.

Crates

Crate Purpose
playhard Umbrella crate for applications that want one dependency.
playhard-automation Page, locator, storage, network, route, and screenshot automation.
playhard-cdp Typed Chrome DevTools Protocol request and response helpers.
playhard-launcher Chrome discovery, profile setup, process launch, and transport selection.
playhard-transport WebSocket and pipe transports with request/response correlation.
test-mock-portal Local workspace scenario runner; not published as a library crate.

Requirements

  • Rust 1.81 or newer.
  • A Chrome or Chromium installation available to chrome-locations, unless you connect to an existing DevTools endpoint yourself.

Quick Start

Add the umbrella crate from this repository:

[dependencies]
playhard = { git = "https://github.com/shirshak55/playhard" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Launch Chrome, open a page, and read the title:

use playhard::{launcher::LaunchOptions, Browser, Result};

#[tokio::main]
async fn main() -> Result<()> {
    let browser = Browser::launch(LaunchOptions {
        headless: true,
        ..LaunchOptions::default()
    })
    .await?;

    let page = browser.new_page().await?;
    page.goto("https://example.com").await?;
    let title = page.evaluate("document.title").await?;

    println!("{title}");
    browser.shutdown().await?;
    Ok(())
}

Development

cargo fmt --all -- --check
cargo check --workspace --all-targets --locked
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
cargo test -p playhard-cdp --locked
cargo test -p playhard-transport --locked
cargo test -p playhard-launcher --locked
cargo test -p playhard-automation --lib --locked
cargo test -p playhard --locked
cargo test -p test-mock-portal --locked
cargo test -p playhard-automation --test feature_tour --locked
cargo test -p playhard-automation --test live_bots -- --ignored --nocapture