async fn execute_script_with_args<'b>(
        &'b self,
        script: &'b str,
        args: &'b ScriptArgs,
    ) -> WebDriverResult<ScriptRet<'b>> {
        let v = self.cmd(Command::ExecuteScript(script.to_owned(), args.get_args())).await?;
        Ok(ScriptRet::new(self.session(), v["value"].clone()))
    }
/// Execute the specified Javascript synchronously and return the result.
///
/// # Example:
/// ```rust
/// use thirtyfour::ScriptArgs;
/// # use thirtyfour::prelude::*;
/// # use thirtyfour::support::block_on;
/// #
/// # fn main() -> WebDriverResult<()> {
/// #     block_on(async {
/// #         let caps = DesiredCapabilities::chrome();
/// #         let driver = WebDriver::new("http://localhost:4444/wd/hub", &caps).await?;
/// #         driver.get("http://webappdemo").await?;
/// let elem = driver.find_element(By::Id("button1")).await?;
/// let mut args = ScriptArgs::new();
/// args.push(elem.clone())?;
/// args.push("TESTING")?;
/// let ret = driver.execute_script_with_args(r#"
///     arguments[0].innerHTML = arguments[1];
///     return arguments[0];
///     "#, &args
/// ).await?;
/// let elem_out = ret.get_element()?;
/// assert_eq!(elem_out.element_id, elem.element_id);
/// assert_eq!(elem_out.text().await?, "TESTING");
/// #         Ok(())
/// #     })
/// # }
/// ```
Execute the specified Javascript synchronously and return the result.
Execute the specified Javascript synchronously and return the result .
async fn execute_script_with_args<'b>(
        &'b self,
        script: &'b str,
        args: &'b ScriptArgs,
    ) -> WebDriverResult<ScriptRet<'b>> {
        let v = self.cmd(Command::ExecuteScript(script.to_owned(), args.get_args())).await?;
        Ok(ScriptRet::new(self.session(), v["value"].clone()))
    }
async fn execute_script_with_args < ' b > ( & ' b self , script : & ' b str , args : & ' b ScriptArgs , ) -> WebDriverResult < ScriptRet < ' b > > { let v = self . cmd ( Command :: ExecuteScript ( script . to_owned ( ) , args . get_args ( ) ) ) . await ? ; Ok ( ScriptRet :: new ( self . session ( ) , v [ " " ] . clone ( ) ) ) }
Execute the specified Javascript synchronously and return the result.
Execute the specified Javascript synchronously and return the result .
&'b self
script
&'b str
args
&'b ScriptArgs
example:
```rust
use thirtyfour::ScriptArgs.
` ` ` rust use thirtyfour :: ScriptArgs .
use thirtyfour::prelude::*;
None
use thirtyfour::support::block_on;
None
fn main() -> webdriverresult<()> {
None
block_on(async {
None
let caps = desiredcapabilities::chrome();
None
let driver = webdriver::new("http://localhost:4444/wd/hub", &caps).await?;
None
driver.get("http://webappdemo").await?;
let elem = driver.find_element(By::Id("button1")).await?;
let mut args = ScriptArgs::new();
args.push(elem.clone())?;
args.push("TESTING")?;
let ret = driver.execute_script_with_args(r#"
arguments[0].innerHTML = arguments[1];
return arguments[0];
"#, &args
).await?;
let elem_out = ret.get_element()?;
assert_eq!(elem_out.element_id, elem.element_id);
assert_eq!(elem_out.text().await?, "TESTING").
let elem = driver . find_element ( By :: Id ( " button1 " )) . await? ; let mut args = ScriptArgs :: new () ; args . push ( elem . clone () ) ? ; args . push ( " TESTING " ) ? ; let ret = driver . execute_script_with_args ( r# " arguments [ 0 ] . innerHTML = arguments [ 1 ] ; return arguments [ 0 ] ; " # &args ) . await? ; let elem_out = ret . get_element () ? ; assert_eq! ( elem_out . element_id elem . element_id ) ; assert_eq! ( elem_out . text () . await? " TESTING " ) .
ok(())
None
})
None
}
None