rust_drission
Browser automation library for Rust via Chrome DevTools Protocol (CDP). Connect or launch Chrome, control pages/elements, run JS, cookies, screenshots, request/response listening. API inspired by DrissionPage.
Features
| Feature | Description |
|---|---|
| Browser | connect to existing Chrome or launch / connect_or_launch with BrowserConfig |
| Page | Navigate, title/URL/HTML, evaluate JS, find elements, click/input, wait helpers |
| Element | Click, text/HTML/attr, input/clear, focus/hover, visibility, children, screenshot |
| Locators | css, xpath, text, attr, id, class, tag, or bare CSS (e.g. #id, .class) |
| Cookie | Get, set, delete |
| Screenshot | Full page and element region |
| Listener | Separate CDP connection to collect request/response data (including body) |
| Stealth | stealth_inject (e.g. navigator.webdriver = false) |
Installation
Add to your Cargo.toml:
[]
= { = "https://github.com/ningning0111/rust_drission" }
Or with a specific version/tag when available:
= { = "https://github.com/ningning0111/rust_drission", = "v0.1.0" }
Requirements: Chrome or Chromium installed, or set RUST_DRISSION_CHROME to the browser executable path.
Quick Start(与 DrissionPage 一致)
使用 ChromiumPage 一步连接/启动浏览器并控制当前标签页(与 Python ChromiumPage() 用法一致):
use ;
或使用 Browser + Page 分步控制:
use ;
To attach to an already running browser, start Chrome with remote debugging first:
Documentation & Examples
| Link | Description |
|---|---|
| Usage (USAGE.md) | Full API usage: browser, page, element, locators, JS, cookies, screenshot, listener |
| API comparison | Differences and missing APIs vs Python DrissionPage |
| Examples | basic, page_ops, run_js, listen_request_response |
Run examples:
Optional env vars: RUST_DRISSION_PORT, RUST_DRISSION_CHROME.
Repository
- Source: github.com/ningning0111/rust_drission
- Homepage: github.com/ningning0111/rust_drission
License
MIT License. See LICENSE.