JAVA Appium Android MultiTouch操作错误消息: “Unable to perform multi pointer gesture” ,“状态”:13

标签 java android appium multi-touch

我在尝试使用 MultiTouchAction 在 google map 元素内执行“缩放”操作时遇到此错误:

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":"Unable to perform multi pointer gesture","status":13}

有人知道发生了什么以及如何解决它,这真的很有帮助吗? 谢谢

我的代码:

try{

     WebElement map = Helper.waitVisibilityOfElement(By.xpath(//android.view.View[@content-desc='Google Map']));

     WebElement carousel = Helper.waitVisibilityOfElement(By.id(MapScreenElements.carouselId));

     int middleX = (int) (map.getLocation().getX()+map.getSize().width*0.5);

     int middleY = (int) (map.getLocation().getY()+(map.getSize().height-carousel.getSize().height)*0.5);

     int topRightX = (int) (map.getLocation().getX()+map.getSize().width);

     int topRightY = map.getLocation().getY();

     int bottomLeftX = map.getLocation().getX();

     int bottomLeftY = (int) (map.getLocation().getY()+(map.getSize().height
carousel.getSize().height));

     TouchAction action0 = new TouchAction(driver).longPress(topRightX,topRightY).moveTo(middleX, middleY).waitAction(500).release();

     TouchAction action1 = new TouchAction(driver).longPress(bottomLeftX,bottomLeftY).moveTo(middleX, middleY).waitAction(500).release();

     MultiTouchAction zoomIn = new MultiTouchAction(driver);

     zoomIn.add(action0);

     zoomIn.add(action1);

     zoomIn.perform();

}catch(Exception e){

    ...

}

我的配置:

  • MAC OS X ElCaptain

  • Java8

  • Appium 服务器 1.5.3

  • Appium 客户端 4.1.2

  • 真实设备 S4 - android 4.4.4 <=> API 19

更多 Appium 服务器日志:

[HTTP] <-- POST /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element 200 35 ms - 88 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/24/displayed {}
[MJSONWP] Calling AppiumDriver.elementDisplayed() with args: ["24","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action"
,"action":"element:getAttribute","params":{"attribute":"displayed","elementId":"24"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getAttribute","params":{"attribute":"displayed","elementId":"24"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getAttribute
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":"true","status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.elementDisplayed() result: true
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/24/displayed 200 32 ms - 76 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location {}
[MJSONWP] Calling AppiumDriver.getLocation() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getLocation
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"y":243,"x":0},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getLocation() result: {"y":243,"x":0}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location 200 47 ms - 87 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size {}
[MJSONWP] Calling AppiumDriver.getSize() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getSize
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"height":1677,"width":1080},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getSize() result: {"height":1677,"width":1080}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size 200 42 ms - 100 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location {}
[MJSONWP] Calling AppiumDriver.getLocation() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getLocation
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"y":243,"x":0},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getLocation() result: {"y":243,"x":0}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location 200 33 ms - 87 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size {}
[MJSONWP] Calling AppiumDriver.getSize() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRA
P LOG] [debug] Got command action: getSize
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"height":1677,"width":1080},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getSize() result: {"height":1677,"width":1080}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size 200 32 ms - 100 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/24/size {}
[MJSONWP] Calling AppiumDriver.getSize() with args: ["24","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getSize","params":{"elementId":"24"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"24"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getSize
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"height":360,"width":1080},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getSize() result: {"height":360,"width":1080}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/24/size 200 30 ms - 99 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location {}
[MJSONWP] Calling AppiumDriver.getLocation() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getLocation
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"y":243,"x":0},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getLocation() result: {"y":243,"x":0}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location 200 43 ms - 87 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size {}
[MJSONWP] Calling AppiumDriver.getSize() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getSize
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"height":1677,"width":1080},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getSize() result: {"height":1677,"width":1080}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size 200 63 ms - 100 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location {}
[MJSONWP] Calling AppiumDriver.getLocation() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getLocation
[debug] [AndroidBootstrap] Received command result from bootstrap
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"y":243,"x":0},"status":0}
[MJSONWP] Responding to client with driver.getLocation() result: {"y":243,"x":0}
[HTTP] <-- GET /wd
/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location 200 40 ms - 87 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location {}
[MJSONWP] Calling AppiumDriver.getLocation() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getLocation
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"y":243,"x":0},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getLocation() result: {"y":243,"x":0}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location 200 43 ms - 87 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location {}
[MJSONWP] Calling AppiumDriver.getLocation() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getLocation","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getLocation
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"y":243,"x":0},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getLocation() result: {"y":243,"x":0}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/location 200 34 ms - 87 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size {}
[MJSONWP] Calling AppiumDriver.getSize() with args: ["23","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"23"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getSize
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"height":1677,"width":1080},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getSize() result: {"height":1677,"width":1080}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/23/size 200 31 ms - 100 
[HTTP] --> GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/24/size {}
[MJSONWP] Calling AppiumDriver.getSize() with args: ["24","0b54fe8b-1222-419b-b...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"element:getSize","params":{"elementId":"24"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"element:getSize","params":{"elementId":"24"}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: getSize
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":{"height":360,"width":1080},"status":0}
[debug] [AndroidBootstrap] Received command result from bootstrap
[MJSONWP] Responding to client with driver.getSize() result: {"height":360,"width":1080}
[HTTP] <-- GET /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/element/24/size 200 31 ms - 99 
[HTTP] --> POST /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/touch/multi/perform {"actions":[[{"action":"longPress","options":{"x":1080,"y":243}},{"action":"moveTo","options":{"x":540,"y":901}},{"action":"wait","options":{"ms":500}
},{"action":"release","options":{}}],[{"action":"longPress","options":{"x":0,"y":1560}},{"action":"moveTo","options":{"x":540,"y":901}},{"action":"wait","options":{"ms":500}},{"action":"release","options":{}}]]}
[MJSONWP] Calling AppiumDriver.performMultiAction() with args: [[[{"action":"longPress","o...
[debug] [AndroidBootstrap] Sending command to android: {"cmd":"action","action":"performMultiPointerGesture","params":{"actions":[[{"action":"longPress","time":0.005,"touch":{"x":1080,"y":243}},{"action":"moveTo","time":0.01,"touch":{"x":1620,"y":1144}},{"action":"wait","time":0.51,"touch":{"ms":500,"x":1620,"y":1144}}],[{"action":"longPress","time":0.005,"touch":{"x":0,"y":1560}},{"action":"moveTo","time":0.01,"touch":{"x":540,"y":2461}},{"action":"wait","time":0.51,"touch":{"ms":500,"x":540,"y":2461}}]]}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {"cmd":"action","action":"performMultiPointerGesture","params":{"actions":[[{"action":"longPress","time":0.005,"touch":{"x":1080,"y":243}},{"action":"moveTo","time":0.01,"touch":{"x":1620,"y":1144}},{"action":"wait","time":0.51,"touch":{"ms":500,"x":1620,"y":1144}}],[{"action":"longPress","time":0.005,"touch":{"x":0,"y":1560}},{"action":"moveTo","time":0.01,"touch":{"x":540,"y":2461}},{"action":"wait","time":0.51,"touch":{"ms":500,"x":540,"y":2461}}]]}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: performMultiPointerGesture

[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {"value":"Unable to perform multi pointer gesture","status":13}

[debug] [AndroidBootstrap] Received command result from bootstrap
[HTTP] <-- POST /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b/touch/multi/perform 500 711 ms - 154

[HTTP] --> DELETE /wd/hub/session/0b54fe8b-1222-419b-bb65-bdc708b2238b {}
[MJSONWP] Calling AppiumDriver.deleteSession() with args: ["0b54fe8b-1222-419b-bb65-b...

感谢您的帮助

最佳答案

对于放大,我使用如下所示,效果很好:

//zoom in the image
MultiTouchAction multiTouch = new MultiTouchAction(driver);
TouchAction action0 = new TouchAction(driver).press(xpos1, ypos1).moveTo(-45,-45).release();
TouchAction action1 = new TouchAction(driver).press(xpos2, ypos2).moveTo(45,45).release();
multiTouch.add(action0).add(action1).perform();

//for zoom in, point used in moveTo() is same but opposite direction

在您的代码中,您使用长按,如果您想使用长按,请使用如下所示:

action1.longPress(topRightX,topRightY).waitAction(3000).moveTo(middleX,middleY).release();
//waitAction is used after long press as it takes some time.

希望这对您有帮助。

关于JAVA Appium Android MultiTouch操作错误消息: “Unable to perform multi pointer gesture” ,“状态”:13,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39963156/

相关文章:

java - 相对于其他字段的易变语义

java - 每个资源的 Jersey 缓存控制

java - 在 Android Studio 中找不到 JDBC 类

android - onChildRemoved() 被多次调用

javascript - JavaScript 的 Bitbar Cloud Appium 服务器端测试包内容

ios - 是否可以在 iOS 中同时自动化两个应用程序?

java - libGDX - 如何将多边形绘制为一条线(斜接连接类型)?

java - @ManyToOne 与连接表的关系(nullable = false)

Android Facebook 共享对话框的内容未显示在主页中

java - Selenium 网络驱动程序 : How to check if a ui element exists on specific screen regardless of if it currently visible/hittable