webdriver: Fix TakeScreenshot to not expect an element parameter that isn't supplied.
authorJames Graham <james@hoppipolla.co.uk>
Fri, 01 May 2015 15:10:20 +0100
changeset 428023 3390b83855898d75a9b9709a66ecfd84b862d7d9
parent 428022 7e129dba133017df18f26340bd7b0c45c2c8c16c
child 428024 f87ded8d37195ec2b61a011c4e54e77935093b2c
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: Fix TakeScreenshot to not expect an element parameter that isn't supplied. Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 432e6000646be7c6abe472c324a5c52469410824
testing/webdriver/src/command.rs
--- a/testing/webdriver/src/command.rs
+++ b/testing/webdriver/src/command.rs
@@ -48,17 +48,17 @@ pub enum WebDriverCommand {
     ElementClick(WebElement),
     ElementTap(WebElement),
     ElementClear(WebElement),
     ElementSendKeys(WebElement, SendKeysParameters),
     DismissAlert,
     AcceptAlert,
     GetAlertText,
     SendAlertText(SendAlertTextParameters),
-    TakeScreenshot(TakeScreenshotParameters)
+    TakeScreenshot
 }
 
 #[derive(PartialEq)]
 pub struct WebDriverMessage {
     pub session_id: Option<String>,
     pub command: WebDriverCommand
 }
 
@@ -259,21 +259,18 @@ impl WebDriverMessage {
                 WebDriverCommand::AcceptAlert
             },
             Route::GetAlertText => {
                 WebDriverCommand::GetAlertText
             },
             Route::SendAlertText => {
                 let parameters: SendAlertTextParameters = try!(Parameters::from_json(&body_data));
                 WebDriverCommand::SendAlertText(parameters)
-            }
-            Route::TakeScreenshot => {
-                let parameters: TakeScreenshotParameters = try!(Parameters::from_json(&body_data));
-                WebDriverCommand::TakeScreenshot(parameters)
-            }
+            },
+            Route::TakeScreenshot => WebDriverCommand::TakeScreenshot,
         };
         Ok(WebDriverMessage::new(session_id, command))
     }
 
     fn get_session_id(params: &Captures) -> Option<String> {
         params.name("sessionId").map(|x| x.to_string())
     }
 }
@@ -290,34 +287,34 @@ impl ToJson for WebDriverMessage {
             WebDriverCommand::GetWindowSize | WebDriverCommand::MaximizeWindow |
             WebDriverCommand::SwitchToParentFrame | WebDriverCommand::IsDisplayed(_) |
             WebDriverCommand::IsSelected(_) | WebDriverCommand::GetElementAttribute(_, _) |
             WebDriverCommand::GetCSSValue(_, _) | WebDriverCommand::GetElementText(_) |
             WebDriverCommand::GetElementTagName(_) | WebDriverCommand::GetElementRect(_) |
             WebDriverCommand::IsEnabled(_) | WebDriverCommand::GetCookie |
             WebDriverCommand::DismissAlert | WebDriverCommand::AcceptAlert |
             WebDriverCommand::GetAlertText | WebDriverCommand::ElementClick(_) |
-            WebDriverCommand::ElementTap(_) | WebDriverCommand::ElementClear(_) => {
+            WebDriverCommand::ElementTap(_) | WebDriverCommand::ElementClear(_) |
+            WebDriverCommand::TakeScreenshot => {
                 None
             },
             WebDriverCommand::Get(ref x) => Some(x.to_json()),
             WebDriverCommand::SetTimeouts(ref x) => Some(x.to_json()),
             WebDriverCommand::SetWindowSize(ref x) => Some(x.to_json()),
             WebDriverCommand::SwitchToWindow(ref x) => Some(x.to_json()),
             WebDriverCommand::SwitchToFrame(ref x) => Some(x.to_json()),
             WebDriverCommand::FindElement(ref x) => Some(x.to_json()),
             WebDriverCommand::FindElements(ref x) => Some(x.to_json()),
             WebDriverCommand::FindElementElement(_, ref x) => Some(x.to_json()),
             WebDriverCommand::FindElementElements(_, ref x) => Some(x.to_json()),
             WebDriverCommand::ElementSendKeys(_, ref x) => Some(x.to_json()),
             WebDriverCommand::ExecuteScript(ref x) |
             WebDriverCommand::ExecuteAsyncScript(ref x) => Some(x.to_json()),
             WebDriverCommand::AddCookie(ref x) => Some(x.to_json()),
             WebDriverCommand::SendAlertText(ref x) => Some(x.to_json()),
-            WebDriverCommand::TakeScreenshot(ref x) => Some(x.to_json())
         };
         if parameters.is_some() {
             data.insert("parameters".to_string(), parameters.unwrap());
         }
         Json::Object(data)
     }
 }