summaryrefslogtreecommitdiff
path: root/src/browser/web_browser.rs
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-08-05 19:00:37 +0200
committerSanto Cariotti <santo@dcariotti.me>2021-08-05 19:00:37 +0200
commit429489349688ce452f124a691c7542d2ca2177d1 (patch)
treee2f124dc11a1bf92f13e172f267ae9ae42e07f53 /src/browser/web_browser.rs
parent51ea2896cdcdf7b6027f96421a0ce2b454486e03 (diff)
feat: handle the callback of the faculty
Diffstat (limited to 'src/browser/web_browser.rs')
-rw-r--r--src/browser/web_browser.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/browser/web_browser.rs b/src/browser/web_browser.rs
index c7497cf..ffbdc13 100644
--- a/src/browser/web_browser.rs
+++ b/src/browser/web_browser.rs
@@ -114,6 +114,27 @@ impl Browser {
Ok(None)
}
+
+ /// Select an option from a list of select elements
+ pub async fn select_option_from_list(
+ &self,
+ klass: &str,
+ property_name: &str,
+ property_value: &str,
+ ) -> WebDriverResult<bool> {
+ if let Some(_d) = &self.driver {
+ _d.find_element(By::Css(
+ &format!("li.{}[{}='{}']", klass, property_name, property_value).to_owned()[..],
+ ))
+ .await?
+ .click()
+ .await?;
+
+ return Ok(true);
+ }
+
+ Ok(false)
+ }
}
/// The static unsafe variable used to open a web browser