@@ -76,6 +76,10 @@ public class MarionetteConnection implements ExtensionConnection, NeedsLocalLogs
76
76
.put (DriverCommand .GET_ELEMENT_LOCATION , "getElementPosition" )
77
77
.put (DriverCommand .GET_ALL_COOKIES , "getAllCookies" )
78
78
.put (DriverCommand .QUIT , "deleteSession" )
79
+ .put (DriverCommand .MOVE_TO , "move" )
80
+ .put (DriverCommand .MOUSE_DOWN , "press" )
81
+ .put (DriverCommand .MOUSE_UP , "release" )
82
+ .put (DriverCommand .CLICK , "click" )
79
83
.build ();
80
84
81
85
private Socket socket ;
@@ -195,39 +199,11 @@ public Response execute(Command command) throws IOException {
195
199
response .setValue (map .get ("value" ));
196
200
197
201
} else {
202
+ response = new JsonToBeanConverter ().convert (Response .class , rawResponse );
198
203
if (map .containsKey ("error" )) {
199
- // ***************************************************************
200
- // Marionette Compliance Issue: Error responses should, at a
201
- // minimum, put the status property at the root of the object.
202
- // In other words:
203
- // {
204
- // status: 7,
205
- // value:
206
- // {
207
- // message: "Did not find element with id=foo",
208
- // stackTrace: <stack trace goes here>
209
- // }
210
- // }
211
- // ***************************************************************
212
- response = new Response ();
213
- Object value = map .get ("error" );
214
- if (value != null ) {
215
- if (value instanceof Map ) {
216
- Map <String , Object > errorMap = (Map <String , Object >) value ;
217
- if (errorMap != null ) {
218
- response .setStatus (Integer .parseInt (errorMap .get ("status" ).toString ()));
219
- errorMap .remove ("status" );
220
- response .setValue (errorMap );
221
- }
222
- } else {
223
- response .setStatus (ErrorCodes .UNHANDLED_ERROR );
224
- response .setValue (value + ": " + map .get ("message" ));
225
- }
226
- }
204
+ response .setValue (map .get ("error" ));
227
205
228
206
} else {
229
- response = new JsonToBeanConverter ().convert (Response .class , rawResponse );
230
-
231
207
// ***************************************************************
232
208
// Marionette Compliance Issue: Responses from findElements
233
209
// are returned with raw element IDs as the value.
@@ -280,7 +256,8 @@ private String serializeCommand(Command command) {
280
256
|| DriverCommand .MOUSE_DOWN .equals (commandName )
281
257
|| DriverCommand .MOUSE_UP .equals (commandName )
282
258
|| DriverCommand .MOVE_TO .equals (commandName )) {
283
- String actionName = commandName ;
259
+ String actionName = seleniumToMarionetteCommandMap .containsKey (commandName ) ?
260
+ seleniumToMarionetteCommandMap .get (commandName ) : commandName ;
284
261
commandName = "actionChain" ;
285
262
List <Object > action = Lists .newArrayList ();
286
263
action .add (actionName );
0 commit comments