Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

rust-headless-chrome

> 编程语言
Open source

A high-level API to control headless Chrome or Chromium over the DevTools Protocol. It is the Rust equivalent of Puppeteer, a Node library maintained by the Chr

2.9K stars0 likes0 views
WebsiteGitHub

About

A high-level API to control headless Chrome or Chromium over the DevTools Protocol. It is the Rust equivalent of Puppeteer, a Node library maintained by the Chr

Headless Chrome

A high-level API to control headless Chrome or Chromium over the DevTools Protocol. It is the Rust equivalent of Puppeteer, a Node library maintained by the Chrome DevTools team.

It is not 100% feature compatible with Puppeteer, but there's enough here to satisfy most browser testing / web crawling use cases, and there are several 'advanced' features such as:

  • network request interception
  • JavaScript coverage monitoring
  • Opening incognito windows
  • taking screenshots of elements or the entire page
  • saving pages to PDF
  • 'headful' browsing
  • automatic downloading of 'known good' Chromium binaries for Linux / Mac / Windows
  • extension pre-loading

Quick Start

…

Auto fetching chrome binary

[dependencies]
headless_chrome = {git = "https://github.com/rust-headless-chrome/rust-headless-chrome", features = ["fetch"]}

For fuller examples, take a look at tests/simple.rs and examples.

Before running examples. Make sure add failure crate in your cargo project dependency of Cargo.toml

What can't it do?

The Chrome DevTools Protocol is huge. Currently, Puppeteer supports way more of it than we do. Some of the missing features include:

  • Dealing with frames
  • Handling file picker / chooser interactions
  • Tapping touchscreens
  • Emulating different network conditions (DevTools can alter latency, throughput, offline status, 'connection type')
  • Viewing timing information about network requests
  • Reading the SSL certificate
  • Replaying XHRs
  • HTTP Basic Auth
  • Inspecting EventSources (aka server-sent events or SSEs)
  • WebSocket inspection

If you're interested in adding one of these features but would like some advice about how to start, please reach out by creating an issue or sending me an email at [email protected].

Related crates

  • fantoccini uses WebDriver, so it works with browsers other than Chrome. It's also asynchronous and based on Tokio, unlike headless_chrome, which has a synchronous API and is just implemented using plain old threads. Fantoccini has also been around longer and is more battle-tested. It doesn't support Chrome DevTools-specific functionality like JS Coverage.

Testing

For debug output, set these environment variables before running cargo test:

RUST_BACKTRACE=1 RUST_LOG=headless_chrome=trace

Version numbers

Starting with v0.2.0, we're trying to follow SemVar strictly.

Troubleshooting

If you get errors related to timeouts, you likely need to enable sandboxing either in the kernel or as a setuid sandbox. Puppeteer has some information about how to do that here.

Contributing

Pull requests and issues are most welcome, even if they're just experience reports. If you find anything frustrating or confusing, let me know!

GitHub Issues· 0 open

View all on GitHub

No open issues yet, or sync has not completed.

Highlights

  • •network request interception
  • •JavaScript coverage monitoring
  • •Opening incognito windows
  • •taking screenshots of elements or the entire page
  • •saving pages to PDF
  • •'headful' browsing
  • •automatic downloading of 'known good' Chromium binaries for Linux / Mac / Windows
  • •extension pre-loading
  • •Dealing with frames
  • •Handling file picker / chooser interactions

> Tags

Rust

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言