ChromeCapabilities

Struct ChromeCapabilities 

Source
pub struct ChromeCapabilities {
    pub base_capabilities: CapabilityRequest,
    pub chrome_options: ChromeOptions,
}
Expand description

Chrome-specific capabilities for configuring browser behavior.

This struct provides a fluent API for setting Chrome capabilities and options. Use the builder methods to configure the browser, then call build() to generate the capabilities request for session creation.

§Examples

use rustenium::browsers::ChromeCapabilities;

let mut caps = ChromeCapabilities::default();
caps.add_arg("--headless")
    .add_arg("--disable-gpu")
    .accept_insecure_certs(true);

let capabilities_request = caps.build();

Fields§

§base_capabilities: CapabilityRequest§chrome_options: ChromeOptions

Implementations§

Source§

impl ChromeCapabilities

Source

pub fn new(base_capabilities: Option<CapabilityRequest>) -> Self

Creates a new ChromeCapabilities instance.

Source

pub fn accept_insecure_certs(&mut self, accept: bool) -> &mut Self

Sets whether to accept insecure (self-signed) certificates.

Source

pub fn browser_name(&mut self, name: impl Into<String>) -> &mut Self

Sets the browser name.

Source

pub fn browser_version(&mut self, version: impl Into<String>) -> &mut Self

Sets the desired browser version.

Source

pub fn platform_name(&mut self, platform: impl Into<String>) -> &mut Self

Sets the platform name.

Source

pub fn proxy(&mut self, proxy: ProxyConfiguration) -> &mut Self

Configures proxy settings.

Source

pub fn unhandled_prompt_behavior( &mut self, behavior: UserPromptHandler, ) -> &mut Self

Sets how to handle unhandled prompts.

Source

pub fn args(&mut self, args: Vec<String>) -> &mut Self

Sets Chrome command-line arguments.

Source

pub fn add_arg(&mut self, arg: impl Into<String>) -> &mut Self

Adds a single Chrome command-line argument (e.g., “–headless”, “–disable-gpu”).

Source

pub fn add_args<I, S>(&mut self, new_args: I) -> &mut Self
where I: IntoIterator<Item = S>, S: Into<String>,

Adds multiple Chrome command-line arguments.

Source

pub fn binary(&mut self, binary: impl Into<String>) -> &mut Self

Sets the path to the Chrome binary.

Source

pub fn extensions(&mut self, extensions: Vec<String>) -> &mut Self

Sets Chrome extensions to load (as base64-encoded .crx files).

Source

pub fn add_extension(&mut self, extension: impl Into<String>) -> &mut Self

Adds a Chrome extension to load.

Source

pub fn local_state(&mut self, local_state: HashMap<String, Value>) -> &mut Self

Sets Chrome’s local state preferences.

Source

pub fn prefs(&mut self, prefs: HashMap<String, Value>) -> &mut Self

Sets Chrome user preferences.

Source

pub fn add_pref(&mut self, key: impl Into<String>, value: Value) -> &mut Self

Adds a single Chrome user preference.

Source

pub fn detach(&mut self, detach: bool) -> &mut Self

Sets whether Chrome should continue running after the driver disconnects.

Source

pub fn debugger_address(&mut self, address: impl Into<String>) -> &mut Self

Sets the debugger address to connect to an existing Chrome instance.

Source

pub fn exclude_switches(&mut self, switches: Vec<String>) -> &mut Self

Sets command-line switches to exclude.

Source

pub fn add_exclude_switch(&mut self, switch: impl Into<String>) -> &mut Self

Adds a command-line switch to exclude.

Source

pub fn minidump_path(&mut self, path: impl Into<String>) -> &mut Self

Sets the directory path for Chrome minidump files.

Source

pub fn mobile_emulation( &mut self, emulation: HashMap<String, Value>, ) -> &mut Self

Configures mobile device emulation.

Source

pub fn perf_logging_prefs(&mut self, prefs: PerfLoggingPrefs) -> &mut Self

Sets performance logging preferences.

Source

pub fn window_types(&mut self, types: Vec<String>) -> &mut Self

Sets which window types to consider.

Source

pub fn add_window_type(&mut self, window_type: impl Into<String>) -> &mut Self

Adds a window type to consider.

Source

pub fn enable_extension_targets(&mut self, enable: bool) -> &mut Self

Sets whether to enable extension targets.

Source

pub fn use_automation_extension(&mut self, use_it: bool) -> &mut Self

Sets whether to use the automation extension.

Source

pub fn build(self) -> CapabilitiesRequest

Builds the final CapabilitiesRequest for session creation.

Trait Implementations§

Source§

impl Clone for ChromeCapabilities

Source§

fn clone(&self) -> ChromeCapabilities

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChromeCapabilities

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChromeCapabilities

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more