Search code examples
javaandroidappiummulti-touch

JAVA Appium Android MultiTouch Action error message : “Unable to perform multi pointer gesture”,”status”:13


I have this error while trying to perform a 'zoom' in action inside a google map element using a MultiTouchAction:

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

Is someone have an idea what happen and How to fix it, it could be really helpful? Thanks

My code:

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){

    ...

}

My configuration:

  • MAC OS X ElCaptain

  • Java8

  • Appium server 1.5.3

  • Appium client 4.1.2

  • Real Device S4- android 4.4.4 <=> API 19

More Appium server logs:

[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...

Thanks for your help


Solution

  • For zoom in, i use like below and it works fine:

    //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
    

    In your code, you use long press, and if you want to use the longpress, use like below:

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

    Hope this will help you.