webdriver: Add GetElementProperty functionality (#36)
authorDavid Burns <david.burns@theautomatedtester.co.uk>
Wed, 22 Jun 2016 12:06:38 +0100
changeset 428074 087daf8007621da2b5a260ac95914b020824133c
parent 428073 3dec738a62914a080a734fe05fc661d2f696c9ca
child 428075 56bf13f38c12204a6d25917d50af6f1c5adcf7d7
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
webdriver: Add GetElementProperty functionality (#36) * Add GetElementProperty functionality This allows to get the value of properties of WebElements and adds symmetry to GetElementAttribute Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 6c195c9d18b28f45b89375d9a8e8eaa4ab3937c2 committer: jgraham <james@hoppipolla.co.uk>
testing/webdriver/src/command.rs
testing/webdriver/src/httpapi.rs
--- a/testing/webdriver/src/command.rs
+++ b/testing/webdriver/src/command.rs
@@ -31,16 +31,17 @@ pub enum WebDriverCommand<T: WebDriverEx
     FindElement(LocatorParameters),
     FindElements(LocatorParameters),
     FindElementElement(WebElement, LocatorParameters),
     FindElementElements(WebElement, LocatorParameters),
     GetActiveElement,
     IsDisplayed(WebElement),
     IsSelected(WebElement),
     GetElementAttribute(WebElement, String),
+    GetElementProperty(WebElement, String),
     GetCSSValue(WebElement, String),
     GetElementText(WebElement),
     GetElementTagName(WebElement),
     GetElementRect(WebElement),
     IsEnabled(WebElement),
     ExecuteScript(JavascriptCommandParameters),
     ExecuteAsyncScript(JavascriptCommandParameters),
     GetCookies,
@@ -185,16 +186,26 @@ impl <U: WebDriverExtensionRoute> WebDri
                                           ErrorStatus::InvalidArgument,
                                           "Missing elementId parameter");
                 let element = WebElement::new(element_id.to_string());
                 let attr = try_opt!(params.name("name"),
                                     ErrorStatus::InvalidArgument,
                                     "Missing name parameter").to_string();
                 WebDriverCommand::GetElementAttribute(element, attr)
             },
+            Route::GetElementProperty => {
+                let element_id = try_opt!(params.name("elementId"),
+                                          ErrorStatus::InvalidArgument,
+                                          "Missing elementId parameter");
+                let element = WebElement::new(element_id.to_string());
+                let property = try_opt!(params.name("name"),
+                                        ErrorStatus::InvalidArgument,
+                                        "Missing name parameter").to_string();
+                WebDriverCommand::GetElementProperty(element, property)
+            },
             Route::GetCSSValue => {
                 let element_id = try_opt!(params.name("elementId"),
                                           ErrorStatus::InvalidArgument,
                                           "Missing elementId parameter");
                 let element = WebElement::new(element_id.to_string());
                 let property = try_opt!(params.name("propertyName"),
                                         ErrorStatus::InvalidArgument,
                                         "Missing propertyName parameter").to_string();
@@ -319,17 +330,18 @@ impl <U:WebDriverExtensionRoute> ToJson 
             WebDriverCommand::NewSession(_) |
             WebDriverCommand::DeleteSession | WebDriverCommand::GetCurrentUrl |
             WebDriverCommand::GoBack | WebDriverCommand::GoForward | WebDriverCommand::Refresh |
             WebDriverCommand::GetTitle | WebDriverCommand::GetPageSource |
             WebDriverCommand::GetWindowHandle | WebDriverCommand::GetWindowHandles |
             WebDriverCommand::Close | WebDriverCommand::GetWindowSize | WebDriverCommand::MaximizeWindow |
             WebDriverCommand::SwitchToParentFrame | WebDriverCommand::GetActiveElement |
             WebDriverCommand::IsDisplayed(_) | WebDriverCommand::IsSelected(_) |
-            WebDriverCommand::GetElementAttribute(_, _) | WebDriverCommand::GetCSSValue(_, _) |
+            WebDriverCommand::GetElementAttribute(_, _) | WebDriverCommand::GetElementProperty(_, _) |
+            WebDriverCommand::GetCSSValue(_, _) |
             WebDriverCommand::GetElementText(_) | WebDriverCommand::GetElementTagName(_) |
             WebDriverCommand::GetElementRect(_) | WebDriverCommand::IsEnabled(_) |
             WebDriverCommand::GetCookies | WebDriverCommand::GetCookie(_) |
             WebDriverCommand::DeleteCookies | WebDriverCommand::DeleteCookie(_) |
             WebDriverCommand::DismissAlert | WebDriverCommand::AcceptAlert |
             WebDriverCommand::GetAlertText | WebDriverCommand::ElementClick(_) |
             WebDriverCommand::ElementTap(_) | WebDriverCommand::ElementClear(_) |
             WebDriverCommand::TakeScreenshot => {
--- a/testing/webdriver/src/httpapi.rs
+++ b/testing/webdriver/src/httpapi.rs
@@ -30,16 +30,17 @@ fn standard_routes<U:WebDriverExtensionR
                 (Post, "/session/{sessionId}/element", Route::FindElement),
                 (Post, "/session/{sessionId}/elements", Route::FindElements),
                 (Post, "/session/{sessionId}/element/{elementId}/element", Route::FindElementElement),
                 (Post, "/session/{sessionId}/element/{elementId}/elements", Route::FindElementElements),
                 (Get, "/session/{sessionId}/element/active", Route::GetActiveElement),
                 (Get, "/session/{sessionId}/element/{elementId}/displayed", Route::IsDisplayed),
                 (Get, "/session/{sessionId}/element/{elementId}/selected", Route::IsSelected),
                 (Get, "/session/{sessionId}/element/{elementId}/attribute/{name}", Route::GetElementAttribute),
+                (Get, "/session/{sessionId}/element/{elementId}/property/{name}", Route::GetElementProperty),
                 (Get, "/session/{sessionId}/element/{elementId}/css/{propertyName}", Route::GetCSSValue),
                 (Get, "/session/{sessionId}/element/{elementId}/text", Route::GetElementText),
                 (Get, "/session/{sessionId}/element/{elementId}/name", Route::GetElementTagName),
                 (Get, "/session/{sessionId}/element/{elementId}/rect", Route::GetElementRect),
                 (Get, "/session/{sessionId}/element/{elementId}/enabled", Route::IsEnabled),
                 (Post, "/session/{sessionId}/execute/sync", Route::ExecuteScript),
                 (Post, "/session/{sessionId}/execute/async", Route::ExecuteAsyncScript),
                 (Get, "/session/{sessionId}/cookie", Route::GetCookies),
@@ -94,16 +95,17 @@ pub enum Route<U:WebDriverExtensionRoute
     FindElement,
     FindElements,
     FindElementElement,
     FindElementElements,
     GetActiveElement,
     IsDisplayed,
     IsSelected,
     GetElementAttribute,
+    GetElementProperty,
     GetCSSValue,
     GetElementText,
     GetElementTagName,
     GetElementRect,
     IsEnabled,
     ExecuteScript,
     ExecuteAsyncScript,
     GetCookies,