Skip to main content
Early Feature: plugins seleniumbase-rs-plugin 0.1.2

The browser-plugin API of seleniumbase-rs is the crate seleniumbase-rs-plugin in the seleniumbase-rs-plugins repository. A plugin is a type that implements its Plugin trait; a PluginSet holds the plugins a program uses, checks them and calls their hooks; seleniumbase-rs calls the set from both of its engines. These pages document every public item at the revision seleniumbase-rs pins, 628991af0e6c5711298e3bd3692dc2974887401a, as the code defines it. For a tutorial, read Writing your own; for the design, Plugin architecture.

Info

Quick reference

  • API crate: seleniumbase-rs-plugin (Rust 2024, MSRV 1.88, MIT); from seleniumbase-rs it is seleniumbase_rs::plugin_api, feature plugins.
  • Required: fn name(&self) -> &str. Hooks: before_launch, on_browser, on_page_created, on_close.
  • By name: Configurable, Descriptor, PluginSpec, Registry.
  • Tests: seleniumbase-rs-plugin-testing (RecordingPage, RecordingBrowser, Call, block_on).
  • Pin: every dependency on the plugins repository at rev = "628991af0e6c5711298e3bd3692dc2974887401a".

Depend on it#

A plugin crate depends on the API crate only, never on seleniumbase-rs, so it keeps working as seleniumbase-rs changes. A program that runs plugins depends on seleniumbase-rs with the feature plugins and on the plugin crates it uses.

Warning

seleniumbase-rs takes seleniumbase-rs-plugin and seleniumbase-rs-plugins-builtin from one git URL at one rev, 628991af0e6c5711298e3bd3692dc2974887401a. Cargo counts the same repository under another reference (a branch, a tag, another rev) as another source, so a plugin crate pinned differently builds a second copy of the API, and its Plugin is not the trait seleniumbase-rs calls. See Cargo features.

Two paths to the same items#

InWriteNeeds
A plugin crateuse seleniumbase_rs_plugin::...the API crate
A program that uses seleniumbase-rsuse seleniumbase_rs::plugin_api::...seleniumbase-rs with the feature plugins

seleniumbase_rs::plugin_api is a re-export of the whole crate (pub use seleniumbase_rs_plugin as plugin_api), so the two paths name the same types. It is not the module seleniumbase_rs::plugins, which holds the test-reporting plugins.

Stability#

The API crate is on 0.1.x and changes by addition. Items marked #[non_exhaustive] can grow:

  • enums PluginError, Engine, BrowserFamily, ProfileView, WebRtcPolicy, Category, Phase, Capability and HostKind: a match on one needs a wildcard arm;
  • structs LaunchSettings, Metadata, Budgets and AuditRow: their public fields can be read and assigned, but code outside the crate cannot build one with a struct literal. Start from LaunchSettings::default(), Metadata::new, Budgets::default().

Pages#

Module map#

The API crate, crates/seleniumbase-rs-plugin/src/ in the plugins repository:

FilePublic itemsPage
lib.rsPlugin, Result, PluginError, async_traitThe Plugin trait
lib.rsLaunchContext, LaunchSettings, ProfileView, Engine, BrowserFamily, WebRtcPolicyLaunch settings
lib.rsBrowserHandle, PageHandleHandles
lib.rsPluginSet, AuditRowPluginSet
lib.rsRequirements, PackageRequirements and packages
config.rsConfigurable, Descriptor, PluginSpec, RegistryConfiguration
metadata.rsMetadata, Category, Phase, Seals, BudgetsMetadata
capability.rsCapability, CapabilitySet, HostScope, NetScope, PathScope, RawKind, Risk, Enforcement, ParseCapabilityErrorCapabilities
host.rsHostInfo, HostKindCapabilities
switch_policy.rsmodule switch_policy: REFUSED_SWITCHES, REFUSED_FEATURES, switch_name, refusal, feature_refusedCapabilities
order.rsnothing public: the resolver behind the run orderPluginSet

The testing crate, crates/seleniumbase-rs-plugin-testing/src/lib.rs: RecordingPage, RecordingBrowser, Call, block_on (Testing).

The host side, in seleniumbase-rs:

PathPublic itemsPage
src/lib.rsplugin_api, builtin_plugins (re-exports)Host
src/sb_cdp/launch.rsLaunchOptionsBuilder::plugins, plugins_named, plugin_selectionHost
src/sb_cdp/browser.rsBrowser::connect_with_pluginsHost
src/browser/config.rsBrowserConfig::with_plugins, with_plugins_named, with_plugin_selection, pluginsHost
src/plugin_host/builtin_registry, build, build_with; the request guardHost
src/error.rsSeleniumBaseError::PluginHost
src/config/plugins.rsPluginSelection, PLUGINS_ENVSelection
src/config/settings.rsSettings::load_plugin_selection, load_plugin_table, Settings::pluginsSelection
src/cli/plugin_cmd.rsPluginChoice, PluginSource, PluginOrigin, check_selection, check_selection_with, check_origins_with, apply_to_config, list, list_with, info, info_withSelection

Guides#