webdriver: Add Tag Name as a valid location strategy. (#118)
authorDavid Burns <david.burns@theautomatedtester.co.uk>
Thu, 24 Aug 2017 14:22:02 +0100
changeset 428167 7a1f04b90639a3d58a5210cc144b4db7f7a58323
parent 428166 41ea2a29992c352f1a0438dec41d00571c022f80
child 428168 d42ac5c19480cc34f3e730e3a4a0691fccbed47e
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 Tag Name as a valid location strategy. (#118) * Add Tag Name as a valid location strategy. While creating WDSpec for Find Element and similar commands it showed that we do not support Tag Name as a valid selector. Tests can be found at https://reviewboard.mozilla.org/r/172110/ Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 5cd49eb129f4ae1ae7e047f274cfa31092353d65 committer: jgraham <james@hoppipolla.co.uk>
testing/webdriver/src/common.rs
--- a/testing/webdriver/src/common.rs
+++ b/testing/webdriver/src/common.rs
@@ -184,40 +184,43 @@ impl ToJson for FrameId {
     }
 }
 
 #[derive(Debug, PartialEq)]
 pub enum LocatorStrategy {
     CSSSelector,
     LinkText,
     PartialLinkText,
+    TagName,
     XPath,
 }
 
 impl LocatorStrategy {
     pub fn from_json(body: &Json) -> WebDriverResult<LocatorStrategy> {
         match try_opt!(body.as_string(),
                        ErrorStatus::InvalidArgument,
                        "Expected locator strategy as string") {
             "css selector" => Ok(LocatorStrategy::CSSSelector),
             "link text" => Ok(LocatorStrategy::LinkText),
             "partial link text" => Ok(LocatorStrategy::PartialLinkText),
+            "tag name" => Ok(LocatorStrategy::TagName),
             "xpath" => Ok(LocatorStrategy::XPath),
             x => Err(WebDriverError::new(ErrorStatus::InvalidArgument,
                                          format!("Unknown locator strategy {}", x)))
         }
     }
 }
 
 impl ToJson for LocatorStrategy {
     fn to_json(&self) -> Json {
         Json::String(match *self {
             LocatorStrategy::CSSSelector => "css selector",
             LocatorStrategy::LinkText => "link text",
             LocatorStrategy::PartialLinkText => "partial link text",
+            LocatorStrategy::TagName => "tag name",
             LocatorStrategy::XPath => "xpath"
         }.to_string())
     }
 }
 
 /// The top-level browsing context has an associated window state which
 /// describes what visibility state its OS widget window is in.
 ///