rustwright 0.1.1

Idiomatic native Rust API for the Rustwright Chromium CDP engine (a Rust rewrite of Playwright).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use rustwright::{chromium, GotoOptions, LaunchOptions};

fn main() -> rustwright::Result<()> {
    let browser = chromium().launch(LaunchOptions::default())?;
    let result = (|| {
        let page = browser.new_page()?;
        page.goto(
            "data:text/html,%3Ctitle%3ERustwright%20works%3C%2Ftitle%3E",
            GotoOptions::default(),
        )?;
        println!("{}", page.title(Default::default())?);
        page.close(Default::default())
    })();
    let close_result = browser.close();
    result.and(close_result)
}