Skip to main content

What a plugin learns about a browser before it starts, and what it may change. The set checks every plugin against a LaunchContext; before_launch gets the browser’s LaunchSettings, which the host turns into the engine’s own options after every plugin has run. Items are in seleniumbase_rs_plugin, defined in crates/seleniumbase-rs-plugin/src/lib.rs.

LaunchContext#

struct seleniumbase_rs_plugin::LaunchContext

What the set checks a plugin against before a browser starts, in PluginSet::check and check_with. It is not #[non_exhaustive], so a test builds one with a struct literal.

engineEnginerequired#

The engine that will run the browser.

familyBrowserFamilyrequired#

The browser’s family. Requirements::CHROMIUM_ONLY refuses any other than Chromium.

headlessboolrequired#

Whether the browser runs without a window. Requirements::HEADFUL refuses true.

connectingboolrequired#

Whether the program attaches to a running browser instead of starting one. Requirements::LAUNCH_ONLY refuses true.

What the hosts of seleniumbase-rs pass:

Whereenginefamilyheadlessconnecting
Pure CDP, Browser::launchCdpChromiumthe options’ headless settingfalse
Pure CDP, Browser::connect_with_pluginsCdpChromiumwhether the user agent of /json/version holds HeadlessChrometrue
WebDriver, BrowserSession::connectWebDriverfrom BrowserConfig::browserthe headless setting; always false for Safaritrue when the WebDriver URL is not the local default
WebDriver, a server that answers browserName: tauriWebDriverEmbeddedfalsetrue

A launch checks the set twice, before and after before_launch, because a plugin may change what another was checked against, such as headless mode.

LaunchSettings#

struct non_exhaustive seleniumbase_rs_plugin::LaunchSettings

The start-up settings a plugin may change in before_launch. After each plugin, PluginSet::before_launch compares the settings with what they were and refuses a change the plugin may not make, as PluginError::Capability or PluginError::Sealed. Outside the crate, start from LaunchSettings::default() and assign the fields.

argsVec<String>#

Command-line switches for the browser, such as --lang=de. Adding needs launch.args; entries may not be removed. A switch of REFUSED_SWITCHES, and a --disable-features= or --enable-features= that names a refused feature, is refused unless the plugin holds raw:switches.

prefsserde_json::Map<String, Value>#

Browser preferences, as in Chrome’s Preferences file. Changing needs launch.prefs; a key that is there may not be removed (it removed a preference another plugin set). The pure CDP engine reads a dotted name such as intl.accept_languages as a path, as LaunchOptionsBuilder::preference does.

extensionsVec<PathBuf>#

Unpacked extension folders to load. Adding needs launch.extensions; entries may not be removed.

proxyOption<String>#

The proxy server, such as http://127.0.0.1:8080. Changing needs launch.proxy. The host shows the server only: a password in the launch options is never shown to plugins, and it stays when they leave the proxy as it is. Seals::PROXY can seal it.

headlessbool#

Whether the browser runs without a window. Changing needs launch.headless. Seals::HEADLESS can seal it.

host_resolver_rulesVec<String>#

Host-resolver rules; the host joins them into one --host-resolver-rules switch. Changing needs launch.network; entries may not be removed.

webrtc_policyOption<WebRtcPolicy>#

The WebRTC IP-handling policy. Changing needs launch.network. Seals::WEBRTC can seal it.

disable_featuresVec<String>#

Features to disable; the host merges them into one --disable-features switch. Adding needs launch.args; entries may not be removed; IsolateOrigins and site-per-process are refused unless the plugin holds raw:switches.

enable_featuresVec<String>#

Features to enable, merged into one --enable-features switch. The same rules as disable_features.

disable_quicbool#

Whether to turn QUIC off (--disable-quic). Changing needs launch.network.

Note

CapabilitySet::legacy(), the grants of a plugin that declares no metadata, holds launch.args, launch.prefs, launch.headless, launch.proxy and launch.extensions but not launch.network: such a plugin may not change host_resolver_rules, webrtc_policy or disable_quic.

What each engine fills in and applies#

HostFills inApplies
Pure CDPEvery field from the LaunchOptions: extra arguments, preferences, extensions, the proxy’s server, headless, host rules, features, QUIC, WebRTC policy, and the profileEvery field back into the options. A proxy that does not parse is SeleniumBaseError::InvalidConfig. WebRtcPolicy::Default adds no switch
WebDriver, Chromiumextra_args; the prefs of goog:chromeOptions (ms:edgeOptions for Edge); the folders of extension_dir; the proxy without its password; headless. The other fields start emptyargs become extra_args; host rules, features, WebRTC policy and QUIC become one switch each, merged with one already there; extensions become extension_dir (each path UTF-8 and without a comma)
WebDriver, FirefoxThe arguments and preferences of the Firefox options; headlessArguments and preferences. Host rules, WebRTC policy, features, QUIC, extensions and a proxy are refused; a preference must be a boolean, a whole number or text
WebDriver, SafariHeadless only, always falseAny change of arguments, preferences, extensions, proxy, headless or the Chromium-only fields is refused

A refusal on Firefox or Safari is SeleniumBaseError::Plugin (a plugin's before_launch asked for what Firefox cannot do here: ...). The guide has the details per browser: The WebDriver engine.

LaunchSettings::profile#

fn seleniumbase_rs_plugin::LaunchSettings::profile

return&ProfileView#

The browser profile this launch uses, read-only for plugins.

The hosts show ProfileView::Persistent(folder) when the launch names a profile folder (user_data_dir), and ProfileView::Ephemeral otherwise.

LaunchSettings::set_profile#

fn seleniumbase_rs_plugin::LaunchSettings::set_profile

profileProfileViewrequired#

The profile of the launch.

For the host, before the plugins run. A plugin that calls it is refused after its hook: PluginError::Capability on profile, the profile is read-only for plugins.

ProfileView#

enum non_exhaustive seleniumbase_rs_plugin::ProfileView

ProfileViewenum#

Engine#

enum non_exhaustive seleniumbase_rs_plugin::Engine

Which of seleniumbase-rs’s engines runs the browser. A plugin reads it from LaunchContext::engine, BrowserHandle::engine and PageHandle::engine.

Engineenum#

BrowserFamily#

enum non_exhaustive seleniumbase_rs_plugin::BrowserFamily

The family of the browser a plugin runs with.

BrowserFamilyenum#

The WebDriver engine refuses plugins for Internet Explorer, which is none of these families, with SeleniumBaseError::Plugin.

WebRtcPolicy#

enum non_exhaustive seleniumbase_rs_plugin::WebRtcPolicy

Chrome’s WebRTC IP-handling policies, the value of LaunchSettings::webrtc_policy. Both engines turn it into one --force-webrtc-ip-handling-policy switch.

WebRtcPolicyenum#

A policy added to the API later, which this version of seleniumbase-rs cannot apply, is SeleniumBaseError::InvalidConfig.