|
19 | 19 |
|
20 | 20 | import static com.google.common.base.Preconditions.checkNotNull;
|
21 | 21 |
|
22 |
| -import static io.appium.java_client.MobileCommand.CLOSE_APP; |
23 |
| -import static io.appium.java_client.MobileCommand.GET_DEVICE_TIME; |
24 | 22 | import static io.appium.java_client.MobileCommand.GET_SESSION;
|
25 | 23 | import static io.appium.java_client.MobileCommand.GET_SETTINGS;
|
26 |
| -import static io.appium.java_client.MobileCommand.GET_STRINGS; |
27 |
| -import static io.appium.java_client.MobileCommand.HIDE_KEYBOARD; |
28 |
| -import static io.appium.java_client.MobileCommand.INSTALL_APP; |
29 |
| -import static io.appium.java_client.MobileCommand.IS_APP_INSTALLED; |
30 |
| -import static io.appium.java_client.MobileCommand.LAUNCH_APP; |
31 |
| -import static io.appium.java_client.MobileCommand.PERFORM_MULTI_TOUCH; |
32 |
| -import static io.appium.java_client.MobileCommand.PERFORM_TOUCH_ACTION; |
33 |
| -import static io.appium.java_client.MobileCommand.PULL_FILE; |
34 |
| -import static io.appium.java_client.MobileCommand.PULL_FOLDER; |
35 |
| -import static io.appium.java_client.MobileCommand.REMOVE_APP; |
36 |
| -import static io.appium.java_client.MobileCommand.RUN_APP_IN_BACKGROUND; |
37 | 24 | import static io.appium.java_client.MobileCommand.SET_SETTINGS;
|
38 | 25 | import static io.appium.java_client.MobileCommand.prepareArguments;
|
39 | 26 |
|
40 |
| -import com.google.common.collect.ImmutableList; |
41 | 27 | import com.google.common.collect.ImmutableMap;
|
42 | 28 | import com.google.gson.JsonObject;
|
43 | 29 | import com.google.gson.JsonParser;
|
|
75 | 61 | import java.util.List;
|
76 | 62 | import java.util.Map;
|
77 | 63 | import java.util.Set;
|
78 |
| -import javax.xml.bind.DatatypeConverter; |
79 | 64 |
|
80 | 65 | /**
|
81 | 66 | * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.
|
@@ -231,123 +216,10 @@ public List<T> findElementsByXPath(String using) {
|
231 | 216 | return super.findElementsByAccessibilityId(using);
|
232 | 217 | }
|
233 | 218 |
|
234 |
| - @Override protected Response execute(String command) { |
235 |
| - return super.execute(command, ImmutableMap.<String, Object>of()); |
236 |
| - } |
237 |
| - |
238 | 219 | @Override public ExecuteMethod getExecuteMethod() {
|
239 | 220 | return executeMethod;
|
240 | 221 | }
|
241 | 222 |
|
242 |
| - /** |
243 |
| - * @see InteractsWithApps#resetApp(). |
244 |
| - */ |
245 |
| - @Override public void resetApp() { |
246 |
| - execute(MobileCommand.RESET); |
247 |
| - } |
248 |
| - |
249 |
| - /** |
250 |
| - * @see InteractsWithApps#isAppInstalled(String). |
251 |
| - */ |
252 |
| - @Override public boolean isAppInstalled(String bundleId) { |
253 |
| - Response response = execute(IS_APP_INSTALLED, ImmutableMap.of("bundleId", bundleId)); |
254 |
| - |
255 |
| - return Boolean.parseBoolean(response.getValue().toString()); |
256 |
| - } |
257 |
| - |
258 |
| - /** |
259 |
| - * @see InteractsWithApps#installApp(String). |
260 |
| - */ |
261 |
| - @Override public void installApp(String appPath) { |
262 |
| - execute(INSTALL_APP, ImmutableMap.of("appPath", appPath)); |
263 |
| - } |
264 |
| - |
265 |
| - /** |
266 |
| - * @see InteractsWithApps#removeApp(String). |
267 |
| - */ |
268 |
| - @Override public void removeApp(String bundleId) { |
269 |
| - execute(REMOVE_APP, ImmutableMap.of("bundleId", bundleId)); |
270 |
| - } |
271 |
| - |
272 |
| - /** |
273 |
| - * @see InteractsWithApps#launchApp(). |
274 |
| - */ |
275 |
| - @Override public void launchApp() { |
276 |
| - execute(LAUNCH_APP); |
277 |
| - } |
278 |
| - |
279 |
| - /** |
280 |
| - * @see InteractsWithApps#closeApp(). |
281 |
| - */ |
282 |
| - @Override public void closeApp() { |
283 |
| - execute(CLOSE_APP); |
284 |
| - } |
285 |
| - |
286 |
| - /** |
287 |
| - * @see InteractsWithApps#runAppInBackground(int). |
288 |
| - */ |
289 |
| - @Override public void runAppInBackground(int seconds) { |
290 |
| - execute(RUN_APP_IN_BACKGROUND, ImmutableMap.of("seconds", seconds)); |
291 |
| - } |
292 |
| - |
293 |
| - /** |
294 |
| - * @see DeviceActionShortcuts#getDeviceTime(). |
295 |
| - */ |
296 |
| - @Override public String getDeviceTime() { |
297 |
| - Response response = execute(GET_DEVICE_TIME); |
298 |
| - return response.getValue().toString(); |
299 |
| - } |
300 |
| - |
301 |
| - /** |
302 |
| - * @see DeviceActionShortcuts#hideKeyboard(). |
303 |
| - */ |
304 |
| - @Override public void hideKeyboard() { |
305 |
| - execute(HIDE_KEYBOARD); |
306 |
| - } |
307 |
| - |
308 |
| - /** |
309 |
| - * @see InteractsWithFiles#pullFile(String). |
310 |
| - */ |
311 |
| - @Override public byte[] pullFile(String remotePath) { |
312 |
| - Response response = execute(PULL_FILE, ImmutableMap.of("path", remotePath)); |
313 |
| - String base64String = response.getValue().toString(); |
314 |
| - |
315 |
| - return DatatypeConverter.parseBase64Binary(base64String); |
316 |
| - } |
317 |
| - |
318 |
| - /** |
319 |
| - * @see InteractsWithFiles#pullFolder(String). |
320 |
| - */ |
321 |
| - @Override |
322 |
| - public byte[] pullFolder(String remotePath) { |
323 |
| - Response response = execute(PULL_FOLDER, ImmutableMap.of("path", remotePath)); |
324 |
| - String base64String = response.getValue().toString(); |
325 |
| - |
326 |
| - return DatatypeConverter.parseBase64Binary(base64String); |
327 |
| - } |
328 |
| - |
329 |
| - /** |
330 |
| - * @see PerformsTouchActions#performTouchAction(TouchAction). |
331 |
| - */ |
332 |
| - @SuppressWarnings("rawtypes") |
333 |
| - @Override public TouchAction performTouchAction( |
334 |
| - TouchAction touchAction) { |
335 |
| - ImmutableMap<String, ImmutableList> parameters = touchAction.getParameters(); |
336 |
| - execute(PERFORM_TOUCH_ACTION, parameters); |
337 |
| - return touchAction; |
338 |
| - } |
339 |
| - |
340 |
| - /** |
341 |
| - * @see PerformsTouchActions#performMultiTouchAction(MultiTouchAction). |
342 |
| - */ |
343 |
| - @Override |
344 |
| - @SuppressWarnings({"rawtypes"}) |
345 |
| - public void performMultiTouchAction( |
346 |
| - MultiTouchAction multiAction) { |
347 |
| - ImmutableMap<String, ImmutableList> parameters = multiAction.getParameters(); |
348 |
| - execute(PERFORM_MULTI_TOUCH, parameters); |
349 |
| - } |
350 |
| - |
351 | 223 | /**
|
352 | 224 | * @see TouchShortcuts#tap(int, WebElement, int).
|
353 | 225 | */
|
@@ -604,38 +476,6 @@ protected void setSetting(AppiumSetting setting, Object value) {
|
604 | 476 | locationContext.setLocation(location);
|
605 | 477 | }
|
606 | 478 |
|
607 |
| - /** |
608 |
| - * @return a map with localized strings defined in the app. |
609 |
| - * @see HasAppStrings#getAppStringMap(). |
610 |
| - */ |
611 |
| - @Override public Map<String, String> getAppStringMap() { |
612 |
| - Response response = execute(GET_STRINGS); |
613 |
| - return (Map<String, String>) response.getValue(); |
614 |
| - } |
615 |
| - |
616 |
| - /** |
617 |
| - * @param language strings language code. |
618 |
| - * @return a map with localized strings defined in the app. |
619 |
| - * @see HasAppStrings#getAppStringMap(String). |
620 |
| - */ |
621 |
| - @Override public Map<String, String> getAppStringMap(String language) { |
622 |
| - Response response = execute(GET_STRINGS, prepareArguments("language", language)); |
623 |
| - return (Map<String, String>) response.getValue(); |
624 |
| - } |
625 |
| - |
626 |
| - /** |
627 |
| - * @param language strings language code. |
628 |
| - * @param stringFile strings filename. |
629 |
| - * @return a map with localized strings defined in the app. |
630 |
| - * @see HasAppStrings#getAppStringMap(String, String). |
631 |
| - */ |
632 |
| - @Override public Map<String, String> getAppStringMap(String language, String stringFile) { |
633 |
| - String[] parameters = new String[] {"language", "stringFile"}; |
634 |
| - Object[] values = new Object[] {language, stringFile}; |
635 |
| - Response response = execute(GET_STRINGS, prepareArguments(parameters, values)); |
636 |
| - return (Map<String, String>) response.getValue(); |
637 |
| - } |
638 |
| - |
639 | 479 | private TouchAction createTap(WebElement element, int duration) {
|
640 | 480 | TouchAction tap = new TouchAction(this);
|
641 | 481 | return tap.press(element).waitAction(duration).release();
|
|
0 commit comments