thirtyfour::common::capabilities::chrome

Struct ChromeCapabilities

Source
pub struct ChromeCapabilities { /* private fields */ }

Implementations§

Source§

impl ChromeCapabilities

Source

pub fn new() -> Self

Create a new ChromeCapabilities struct.

Source

pub fn add_chrome_option<T>( &mut self, key: &str, value: T, ) -> WebDriverResult<()>
where T: Serialize,

Add the specified Chrome option. This is a helper method for add_chrome_arg().

Source

pub fn get_chrome_option<T>(&self, key: &str) -> T

Get the specified Chrome option.

Source

pub fn get_args(&self) -> Vec<String>

Get the current list of command-line arguments to chromedriver as a vec.

Source

pub fn get_extensions(&self) -> Vec<String>

Get the current list of Chrome extensions as a vec. Each item is a base64-encoded string containing the .CRX extension file contents. Use add_extension() to add a new extension file.

Source

pub fn get_binary(&self) -> String

Get the path to the chrome binary (if one was previously set).

Source

pub fn set_binary(&mut self, path: &str) -> WebDriverResult<()>

Set the path to chrome binary to use.

Source

pub fn get_debugger_address(&self) -> String

Get the current debugger address (if one was previously set).

Source

pub fn set_debugger_address(&mut self, address: &str) -> WebDriverResult<()>

Set the debugger address.

Source

pub fn add_chrome_arg(&mut self, arg: &str) -> WebDriverResult<()>

Add the specified command-line argument to chromedriver. Eg. “–disable-local-storage” The full list of switches can be found here: https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_switches.cc

Source

pub fn remove_chrome_arg(&mut self, arg: &str) -> WebDriverResult<()>

Remove the specified Chrome command-line argument if it had been added previously.

Source

pub fn add_encoded_extension( &mut self, extension_base64: &str, ) -> WebDriverResult<()>

Add a base64-encoded extension.

Source

pub fn remove_encoded_extension( &mut self, extension_base64: &str, ) -> WebDriverResult<()>

Remove the specified base64-encoded extension if it had been added previously.

Source

pub fn add_extension(&mut self, crx_file: &Path) -> WebDriverResult<()>

Add Chrome extension file. This will be a file with a .CRX extension.

Source

pub fn remove_extension(&mut self, crx_file: &Path) -> WebDriverResult<()>

Remove the specified Chrome extension file if an identical extension had been added previously.

Source

pub fn set_headless(&mut self) -> WebDriverResult<()>

Set the browser to run headless.

Source

pub fn unset_headless(&mut self) -> WebDriverResult<()>

Unset the headless option.

Source

pub fn set_disable_web_security(&mut self) -> WebDriverResult<()>

Set disable web security.

Source

pub fn unset_disable_web_security(&mut self) -> WebDriverResult<()>

Unset disable web security.

Source

pub fn set_ignore_certificate_errors(&mut self) -> WebDriverResult<()>

Set ignore certificate errors.

Source

pub fn unset_ignore_certificate_errors(&mut self) -> WebDriverResult<()>

Unset ignore certificate errors.

Source

pub fn set_no_sandbox(&mut self) -> WebDriverResult<()>

Source

pub fn unset_no_sandbox(&mut self) -> WebDriverResult<()>

Source

pub fn set_disable_gpu(&mut self) -> WebDriverResult<()>

Source

pub fn unset_disable_gpu(&mut self) -> WebDriverResult<()>

Source

pub fn set_disable_dev_shm_usage(&mut self) -> WebDriverResult<()>

Source

pub fn unset_disable_dev_shm_usage(&mut self) -> WebDriverResult<()>

Methods from Deref<Target = Capabilities>§

Source

pub fn clear(&mut self)

Clears the map, removing all values.

Source

pub fn get<Q>(&self, key: &Q) -> Option<&Value>
where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Returns a reference to the value corresponding to the key.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

Source

pub fn contains_key<Q>(&self, key: &Q) -> bool
where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Returns true if the map contains a value for the specified key.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

Source

pub fn get_mut<Q>(&mut self, key: &Q) -> Option<&mut Value>
where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Returns a mutable reference to the value corresponding to the key.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

Source

pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&String, &Value)>
where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Returns the key-value pair matching the given key.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

Source

pub fn insert(&mut self, k: String, v: Value) -> Option<Value>

Inserts a key-value pair into the map.

If the map did not have this key present, None is returned.

If the map did have this key present, the value is updated, and the old value is returned.

Source

pub fn remove<Q>(&mut self, key: &Q) -> Option<Value>
where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Removes a key from the map, returning the value at the key if the key was previously in the map.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

Source

pub fn remove_entry<Q>(&mut self, key: &Q) -> Option<(String, Value)>
where String: Borrow<Q>, Q: Ord + Eq + Hash + ?Sized,

Removes a key from the map, returning the stored key and value if the key was previously in the map.

The key may be any borrowed form of the map’s key type, but the ordering on the borrowed form must match the ordering on the key type.

Source

pub fn append(&mut self, other: &mut Map<String, Value>)

Moves all elements from other into self, leaving other empty.

Source

pub fn entry<S>(&mut self, key: S) -> Entry<'_>
where S: Into<String>,

Gets the given key’s corresponding entry in the map for in-place manipulation.

Source

pub fn len(&self) -> usize

Returns the number of elements in the map.

Source

pub fn is_empty(&self) -> bool

Returns true if the map contains no elements.

Source

pub fn iter(&self) -> Iter<'_>

Gets an iterator over the entries of the map.

Source

pub fn iter_mut(&mut self) -> IterMut<'_>

Gets a mutable iterator over the entries of the map.

Source

pub fn keys(&self) -> Keys<'_>

Gets an iterator over the keys of the map.

Source

pub fn values(&self) -> Values<'_>

Gets an iterator over the values of the map.

Source

pub fn values_mut(&mut self) -> ValuesMut<'_>

Gets an iterator over mutable values of the map.

Source

pub fn retain<F>(&mut self, f: F)
where F: FnMut(&String, &mut Value) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all pairs (k, v) such that f(&k, &mut v) returns false.

Trait Implementations§

Source§

impl Clone for ChromeCapabilities

Source§

fn clone(&self) -> ChromeCapabilities

Returns a copy 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
Source§

impl Deref for ChromeCapabilities

Source§

type Target = Map<String, Value>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for ChromeCapabilities

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl From<ChromeCapabilities> for Capabilities

Source§

fn from(caps: ChromeCapabilities) -> Capabilities

Converts to this type from the input type.
Source§

impl Serialize for ChromeCapabilities

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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<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