/// Running an extension command.
/// Extension commands are browser specific commands and using browser specific endpoints and
/// parameters.
///
/// # Example
/// ```no_run
/// use thirtyfour::prelude::*;
/// use thirtyfour::{ExtensionCommand, RequestMethod};
/// use thirtyfour::support::block_on;
/// use serde::Serialize;
///
/// #[derive(Serialize)]
/// pub struct AddonInstallCommand {
///     pub path: String,
///     pub temporary: Option<bool>
/// }
///
/// impl ExtensionCommand for AddonInstallCommand {
///     fn parameters_json(&self)-> Option<serde_json::Value>{
///        Some( serde_json::to_value(self).unwrap())
///     }
///
///     fn method(&self)-> RequestMethod {
///         RequestMethod::Post
///     }
///
///     fn endpoint(&self)->String {
///         String::from("/moz/addon/install")
///     }
/// }
///
///
/// fn main()->WebDriverResult<()>{
///     block_on(async {
///         let caps = DesiredCapabilities::firefox();
///         let driver = WebDriver::new("http://localhost:4444", &caps).await?;
///
///         let install_command = AddonInstallCommand {
///             path: String::from("/path/to/addon.xpi"),
///             temporary: Some(true)
///         };
///
///         let response = driver.extension_command(install_command).await?;
///
///         assert_eq!(response.is_string(), true);
///         driver.quit().await?;
///
///         Ok(())
///     })
/// }
///
/// ```
Running an extension command.
Extension commands are browser specific commands and using browser specific endpoints and
parameters.
Running an extension command . Extension commands are browser specific commands and using browser specific endpoints and parameters .
async fn extension_command<T: ExtensionCommand + Send + Sync + 'static>(
        &self,
        ext_cmd: T,
    ) -> WebDriverResult<serde_json::Value> {
        let response = self.cmd(Command::ExtensionCommand(Box::new(ext_cmd))).await?;
        Ok(response["value"].clone())
    }
async fn extension_command < T : ExtensionCommand + Send + Sync + ' static > ( & self , ext_cmd : T , ) -> WebDriverResult < serde_json :: Value > { let response = self . cmd ( Command :: ExtensionCommand ( Box :: new ( ext_cmd ) ) ) . await ? ; Ok ( response [ " " ] . clone ( ) ) }
Running an extension command.
Running an extension command .
&self
ext_cmd
T
example
None
[derive(serialize)]


impl ExtensionCommand for AddonInstallCommand {
fn parameters_json(&self)-> Option{
Some( serde_json::to_value(self).unwrap())
}

fn method(&self)-> RequestMethod {
RequestMethod::Post
}

fn endpoint(&self)->String {
String::from("/moz/addon/install")
}
}



let install_command = AddonInstallCommand {
path: String::from("/path/to/addon.xpi"),
temporary: Some(true)
}.

let response = driver.extension_command(install_command).await?.

assert_eq!(response.is_string(), true);
driver.quit().await?.




impl ExtensionCommand for AddonInstallCommand { fn parameters_json ( &self ) - > Option { Some ( serde_json :: to_value ( self ) . unwrap () ) } fn method ( &self ) - > RequestMethod { RequestMethod :: Post } fn endpoint ( &self ) - > String { String :: from ( " / moz / addon / install " ) } } let install_command = AddonInstallCommand { path : String :: from ( " / path / to / addon . xpi " ) temporary : Some ( true ) } . let response = driver . extension_command ( install_command ) . await? . assert_eq! ( response . is_string () true ) ; driver . quit () . await? .