playwright 0.0.0

Playwright port to Rust
docs.rs failed to build playwright-0.0.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: playwright-0.0.20

🎭 Playwright for Rust

Playwright is a rust library to automate Chromium, Firefox and WebKit built on top of Node.js library.

Installation

[dependencies]
playwright = "0.0.0"

Usage

use playwright::Playwright;

let playwright = Playwright::initialize().await.unwrap(); // if drop all resources are disposed
playwright.prepare().unwrap(); // install browsers
let mut chromium = playwright.chromium();
let mut browser = chromium.launcher().headless(true).launch().await.unwrap();
let mut context = browser.context_builder().build().await.unwrap();
let mut page = context.new_page().await.unwrap();
page.goto_builder("https://example.com/")
    .goto()
    .await
    .unwrap();
page.click_builder("a").click().await.unwrap();

It's still under development and has limited functions. Please have a look at tests and docs.rs. Welcome contributions.

Incompatibility

Functions do not have default arguments in rust. Functions with two or more optional arguments are now passed with the builder pattern.

Playwright Driver

Playwright is designed as a server-client. All playwright client dependent on the driver: zip of core js library and Node.js. Application uses this library will be bundled the driver into rust binary at build time. There is an overhead of unzipping on the first run.

Browser automation in rust

Other languages