Skip to main content
Early Feature: plugins

Plugins for seleniumbase-rs: Rust crates that change how a browser starts and what every tab gets, the way puppeteer-extra plugins do for Puppeteer. The design is ADR 004. The repository is seleniumbase-rs-plugins:

MustCodeAl/seleniumbase-rs-plugins

Plugin framework and community plugins for seleniumbase-rs

00
Note

Early. Plugins run in seleniumbase-rs 0.3.0 and later, behind its plugins feature, in the pure CDP engine (sb_cdp), and from 0.4.0 in the WebDriver engine (BaseCase) too. The Browser Plugins guide is the user guide: it shows how to attach a set to a browser.

Plugins you can install#

Every plugin is its own crate. The official ones also ship with seleniumbase-rs behind a cargo feature each (plugin-shield, plugin-block-resources, plugin-crx, or plugins-builtin for all) and are switched on by name; see Choosing plugins. The prebuilt sbrs and sbrs-mcp have all of them compiled in: sbrs --plugin shield open https://example.com, and sbrs plugin list shows them. Add the crate of one yourself to use it in code; the plugins are also examples of how to write one.

PluginWhat it does
shieldPrivacy hardening: turns off the browser’s background reporting, keeps WebRTC from leaking addresses, blocks third-party cookies, refuses a persistent profile
block-resourcesStops pages from loading images, fonts or media (faster, less data)
crxLoads packed Chrome extensions (.crx, CRX3 and CRX2)
wasmRuns plugins written in any language that compiles to WebAssembly, sandboxed with wasmi (no host imports, fuel and memory limits)

To add a plugin’s crate, use cargo add with the revision shown. shield is also the feature plugin-shield.

The framework itself:

CrateWhat it is
seleniumbase-rs-pluginThe API: Plugin, PluginSet, LaunchSettings, Package, the BrowserHandle and PageHandle traits
seleniumbase-rs-plugin-testingRecording fakes of the handles, to test a plugin without a browser
templateStart your own plugin from here (see Writing your own); install it by copying the folder

More plugins live in their own repositories, such as tauri-plugin-sbrs-automation. Search GitHub for the topic seleniumbase-rs-plugin to find community ones.

How the hooks run#

Every hook is optional: before_launch (change the browser’s start-up settings), on_browser, on_page_created, on_close. A plugin can also declare JavaScript and CSS packages for every tab, its dependencies on other plugins, and requirements (run last, a visible window, a Chromium browser, a browser it starts itself). Errors in the launch and page hooks stop the launch or the tab instead of being skipped.

The hooks, in the order they run

The details of each hook, and what the pure CDP engine does at each point, are in When the hooks run.

Warning

A plugin is code that runs with your program’s rights and sees every page, cookie and password the browser handles. Review a plugin before you add it, as you would any dependency.

License#

MIT.