错误信息如下:
Tried to execute non-existent mobile command 'swipe'. Most mobile commands have been ported to official client library methods. Please check your Appium library for more information and documentation
环境信息如下:
appium:AppiumForWindows-1.0.0.3
java-client.jar(1.3.0 版本)
安卓版本(采用的虚拟机 4.4.2)
JDK 版本为:1.6
开发环境(目前引用的 3 个包):
java-client-1.3.0.jar
selenium-java-2.44.0.jar
selenium-server-standalone-2.44.0.jar
测试中需要模拟滑动效果,仿照着网上写了如下代码:
private static void screenmoveright(){
//其中的 webdriver 使用的是 AppiumDriver
//AppiumDriver driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
System.out.println("执行拖动方法...");
try {
JavascriptExecutor js =(JavascriptExecutor) driver;
HashMap swipeObject = new HashMap();
swipeObject.put("startX", 260.00);
swipeObject.put("startY", 25.00);
swipeObject.put("endX", 3.00);
swipeObject.put("endY", 25.00);
swipeObject.put("duration", 1000.00);
js.executeScript("mobile:swipe", swipeObject);
} catch (WebDriverException ex) {
ex.printStackTrace();
}
System.out.println("执行拖动方法结束...");
}
目前一执行该方法进行滑动的时候,就报如下的错误:
info: [debug] Appium session started with sessionId 766660cc-2416-4f93-8a34-98c92b6fac6b
info: <-- POST /wd/hub/session 303 31669.348 ms - 9
info: --> GET /wd/hub/session/766660cc-2416-4f93-8a34-98c92b6fac6b {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.4","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"D:\workspace\appdemo\apps\MobileTest.apk","platformVersion":"4.4","deviceName":"Android Emulator","platformName":"Android","browserName":""},"app":"D:\workspace\appdemo\apps\MobileTest.apk","deviceName":"Android Emulator","platformName":"Android"},"sessionId":"766660cc-2416-4f93-8a34-98c92b6fac6b"}
info: <-- GET /wd/hub/session/766660cc-2416-4f93-8a34-98c92b6fac6b 200 1.297 ms - 585 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"4.4","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"D:\workspace\appdemo\apps\MobileTest.apk","platformVersion":"4.4","deviceName":"Android Emulator","platformName":"Android","browserName":""},"app":"D:\workspace\appdemo\apps\MobileTest.apk","deviceName":"Android Emulator","platformName":"Android"},"sessionId":"766660cc-2416-4f93-8a34-98c92b6fac6b"}
info: --> POST /wd/hub/session/766660cc-2416-4f93-8a34-98c92b6fac6b/execute {"script":"mobile: swipe","args":[{"startX":10,"duration":1,"startY":5,"endX":3,"endY":5}]}
info: [debug] Tried to execute non-existent mobile command 'swipe'. Most mobile commands have been ported to official client library methods. Please check your Appium library for more information and documentation
info: [debug] Responding to client that a method is not implemented