Skip to content

Commit

Permalink
Implement dispatch of the new-style actions api
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraham committed Dec 8, 2016
1 parent 1311fd2 commit 3290c87
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -27,5 +27,5 @@ slog-extra = "0.1.1"
slog-stdlog = "1"
slog-stream = "1"
uuid = "0.1.18"
webdriver = "0.16"
webdriver = "0.17"
zip = "0.1.16"
17 changes: 14 additions & 3 deletions src/marionette.rs
Expand Up @@ -34,12 +34,12 @@ use webdriver::command::WebDriverCommand::{
ExecuteScript, ExecuteAsyncScript, GetCookies, GetCookie, AddCookie,
DeleteCookies, DeleteCookie, GetTimeouts, SetTimeouts, DismissAlert,
AcceptAlert, GetAlertText, SendAlertText, TakeScreenshot, TakeElementScreenshot,
Extension, SetWindowPosition, GetWindowPosition};
Extension, SetWindowPosition, GetWindowPosition, PerformActions, ReleaseActions};
use webdriver::command::{
NewSessionParameters, GetParameters, WindowSizeParameters, SwitchToWindowParameters,
SwitchToFrameParameters, LocatorParameters, JavascriptCommandParameters,
GetCookieParameters, AddCookieParameters, TimeoutsParameters,
TakeScreenshotParameters, WindowPositionParameters};
ActionsParameters, TakeScreenshotParameters, WindowPositionParameters};
use webdriver::response::{
WebDriverResponse, NewSessionResponse, ValueResponse, WindowSizeResponse,
WindowPositionResponse, ElementRectResponse, CookieResponse, Cookie};
Expand Down Expand Up @@ -576,7 +576,8 @@ impl MarionetteSession {
SetWindowSize(_) | MaximizeWindow | SwitchToWindow(_) | SwitchToFrame(_) |
SwitchToParentFrame | AddCookie(_) | DeleteCookies | DeleteCookie(_) |
DismissAlert | AcceptAlert | SendAlertText(_) | ElementClick(_) |
ElementTap(_) | ElementClear(_) | ElementSendKeys(_, _) => {
ElementTap(_) | ElementClear(_) | ElementSendKeys(_, _) |
PerformActions(_) | ReleaseActions => {
WebDriverResponse::Void
},
//Things that simply return the contents of the marionette "value" property
Expand Down Expand Up @@ -917,6 +918,8 @@ impl MarionetteCommand {
GetElementTagName(ref x) => (Some("getElementTagName"), Some(x.to_marionette())),
GetElementRect(ref x) => (Some("getElementRect"), Some(x.to_marionette())),
IsEnabled(ref x) => (Some("isElementEnabled"), Some(x.to_marionette())),
PerformActions(ref x) => (Some("performActions"), Some(x.to_marionette())),
ReleaseActions => (Some("releaseActions"), None),
ElementClick(ref x) => (Some("clickElement"), Some(x.to_marionette())),
ElementTap(ref x) => (Some("singleTap"), Some(x.to_marionette())),
ElementClear(ref x) => (Some("clearElement"), Some(x.to_marionette())),
Expand Down Expand Up @@ -1357,6 +1360,14 @@ impl ToMarionette for JavascriptCommandParameters {
}
}

impl ToMarionette for ActionsParameters {
fn to_marionette(&self) -> WebDriverResult<BTreeMap<String, Json>> {
Ok(try_opt!(self.to_json().as_object(),
ErrorStatus::UnknownError,
"Expected an object").clone())
}
}

impl ToMarionette for GetCookieParameters {
fn to_marionette(&self) -> WebDriverResult<BTreeMap<String, Json>> {
Ok(try_opt!(self.to_json().as_object(), ErrorStatus::UnknownError, "Expected an object").clone())
Expand Down

0 comments on commit 3290c87

Please sign in to comment.