sl4f_lib/webdriver/
commands.rs1use crate::server::Facade;
6use anyhow::{format_err, Error};
7use async_trait::async_trait;
8use serde_json::{to_value, Value};
9
10use crate::webdriver::facade::WebdriverFacade;
11
12#[async_trait(?Send)]
13impl Facade for WebdriverFacade {
14 async fn handle_request(&self, method: String, _args: Value) -> Result<Value, Error> {
15 match method.as_ref() {
16 "EnableDevTools" => {
17 let result = self.enable_dev_tools().await?;
18 Ok(to_value(result)?)
19 }
20 "GetDevToolsPorts" => {
21 let result = self.get_dev_tools_ports().await?;
22 Ok(to_value(result)?)
23 }
24 _ => return Err(format_err!("Invalid WebDriver facade method: {:?}", method)),
25 }
26 }
27}