. 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
- 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
For fuller examples, take a look at
Before running examples. Make sure add failure crate in your cargo project dependency of
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
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
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.
For debug output, set these environment variables before running
Starting with v0.2.0, we're trying to follow SemVar strictly.
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
headless_chrome will download a compatible version of chrome to
XDG_DATA_HOME (or equivalent on Windows/Mac). This behaviour can be optionally turned off, and you can use the system version of chrome (assuming you have chrome installed) by disabling the default feature in your
[dependencies.headless_chrome] default-features = false
Pull requests and issues are most welcome, even if they're just experience reports. If you find anything frustrating or confusing, let me know!