Zoom and pinch have no impact though there is no error

Setup:
Appium : 1.3.4.1
Appium java client : 2…2.0
Selenium cleint : 2.43.1
Device : Android Emulator with API Level 18/19
AUT : QuickPic (https://play.google.com/store/apps/details?id=com.alensw.PicFolder&hl=en)

The program source code :
package com.saucelabs.appium;

import static org.junit.Assert.assertEquals;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;

import java.io.File;
import java.net.URL;
import java.util.List;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.TouchAction;
import io.appium.java_client.MultiTouchAction;
import io.appium.java_client.TouchShortcuts;
import io.appium.java_client.MobileElement;
public class AndroidTest {
private AppiumDriver driver;

@Before
public void setUp() throws Exception {
     DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("deviceName","Android Emulator");
    capabilities.setCapability("platformVersion", "4.3");
    capabilities.setCapability("appPackage", "com.alensw.PicFolder");
    capabilities.setCapability("appActivity", ".GalleryActivity");
    driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

@After
public void tearDown() throws Exception {
    driver.quit();
}

@Test
public void apiDemo() throws Exception{

	TouchAction action0=new TouchAction(driver).press(400,600).moveTo(400,700).release();
	TouchAction action1=new TouchAction(driver).press(400,600).moveTo(400,500).release();
	MultiTouchAction mAction=new MultiTouchAction(driver);
	mAction.add(action0).add(action1);		
	
    WebElement el =driver.findElementByAccessibilityId("Mode");
    el.click();
	el =driver.findElement(By.name("List"));
	el.click();
	
	//click on an album
	driver.tap(1,83,217,1);
	Thread.sleep(5000);
	
	//click on first picture in the album
	driver.tap(1,80,194,1);
	Thread.sleep(10000);
	
	//zoom has no impact where as the operation is indicated as pass.
	el =driver.findElement(By.className("android.view.View"));				
	((MobileElement)(el)).zoom();		
	
	//This too does not work.
	mAction.perform();					
	Thread.sleep(5000);

	//This too does not work.
	driver.zoom(400,600);		
}

}

The issue being faced:

The zoom function on mobile element or the zoom function on the driver instance also zoom function constructed using the multi touch functionality fail to zoom the picture. however the appium server reports as success.

I tried the swipe and tap feature using muti touch api’s it works.
Please note the zoom and pinch both function well with python appium client code.

I came across one post where a person was facing similar issue as mine but otherwise it looks like the zoom functionality working for most of you.

Kindly help. It means a lot.

Regards,
Sandeep Tuppad
https://testinsane.com/

The appium server log for the test run is :

info: → POST /wd/hub/session {“desiredCapabilities”:{“appPackage”:“com.alensw.PicFolder”,“appActivity”:“.GalleryActivity”,“platformVersion”:“4.3”,“platformName”:“Android”,“deviceName”:“Android Emulator”}}
info: Client User-Agent string: Apache-HttpClient/4.3.3 (java 1.5)
info: [debug] Didn’t get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session e257243e-ca64-4388-a217-8e86e23c1f5c
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_20
info: [debug] Checking whether adb is present
info: [debug] Using adb from D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Not checking whether app is present since we are assuming it’s already on the device
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices…
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 wait-for-device
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “echo ‘ready’”
info: [debug] Starting logcat capture
warn: No app capability, can’t parse package/activity
info: [debug] Getting device API level
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 18
info: Device API level is: 18
info: [debug] Apk doesn’t exist locally
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “rm -rf /data/local/tmp/strings.json”
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an app path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device…
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 push “D:\android\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar” /data/local/tmp/
info: [debug] Pushing settings apk to device…
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 install “D:\android\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk”
info: [debug] Pushing unlock helper app to device…
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 install “D:\android\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk”
info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “ps ‘uiautomator’”
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] Waking up device if it’s not alive
info: [debug] Pushing command to appium work queue: [“wake”,{}]
info: [debug] [BOOTSTRAP] [debug] Loading json…
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“wake”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “dumpsys window”
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: [“getDataDir”,{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDataDir”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“/data”,“status”:0}
info: [debug] dataDir set to: /data
info: [debug] Pushing command to appium work queue: [“compressedLayoutHierarchy”,{“compressLayout”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“compressedLayoutHierarchy”,“params”:{“compressLayout”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:false,“status”:0}
info: [debug] Getting device API level
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “getprop ro.build.version.sdk”
info: [debug] Device is at API Level 18
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.alensw.PicFolder/.GalleryActivity”
info: [debug] Waiting for pkg “com.alensw.PicFolder” and activity “.GalleryActivity” to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “dumpsys window windows”
info: [debug] Getting focused package and activity
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “dumpsys window windows”
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId e257243e-ca64-4388-a217-8e86e23c1f5c
info: ← POST /wd/hub/session 303 10976.281 ms - 74
info: → GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c {}
info: [debug] Responding to client with success: {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“4.3”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“appPackage”:“com.alensw.PicFolder”,“appActivity”:“.GalleryActivity”,“platformVersion”:“4.3”,“platformName”:“Android”,“deviceName”:“Android Emulator”},“appPackage”:“com.alensw.PicFolder”,“appActivity”:“.GalleryActivity”,“platformName”:“Android”,“deviceName”:“Android Emulator”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c 200 0.856 ms - 603 {“status”:0,“value”:{“platform”:“LINUX”,“browserName”:“Android”,“platformVersion”:“4.3”,“webStorageEnabled”:false,“takesScreenshot”:true,“javascriptEnabled”:true,“databaseEnabled”:false,“networkConnectionEnabled”:true,“locationContextEnabled”:false,“warnings”:{},“desired”:{“appPackage”:“com.alensw.PicFolder”,“appActivity”:“.GalleryActivity”,“platformVersion”:“4.3”,“platformName”:“Android”,“deviceName”:“Android Emulator”},“appPackage”:“com.alensw.PicFolder”,“appActivity”:“.GalleryActivity”,“platformName”:“Android”,“deviceName”:“Android Emulator”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element {“using”:“accessibility id”,“value”:“Mode”}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“accessibility id”,“selector”:“Mode”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“accessibility id”,“selector”:“Mode”,“context”:“”,“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding Mode using ACCESSIBILITY_ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=Mode, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“ELEMENT”:“1”},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element 200 2256.046 ms - 87 {“status”:0,“value”:{“ELEMENT”:“1”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/1/click {“id”:“1”}
info: [debug] Pushing command to appium work queue: [“element:click”,{“elementId”:“1”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“1”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/1/click 200 837.728 ms - 76 {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element {“using”:“name”,“value”:“List”}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“name”,“selector”:“List”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“name”,“selector”:“List”,“context”:“”,“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding List using NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[DESCRIPTION=List, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[TEXT=List, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“ELEMENT”:“2”},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“2”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element 200 952.379 ms - 87 {“status”:0,“value”:{“ELEMENT”:“2”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/2/click {“id”:“2”}
info: [debug] Pushing command to appium work queue: [“element:click”,{“elementId”:“2”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:click”,“params”:{“elementId”:“2”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: click
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/2/click 200 3241.650 ms - 76 {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/perform {“actions”:[{“options”:{“x”:83,“y”:217},“action”:“press”},{“options”:{“ms”:1},“action”:“wait”},{“options”:{},“action”:“release”}]}
info: [debug] Pushing command to appium work queue: [“element:touchDown”,{“x”:83,“y”:217}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:touchDown”,“params”:{“x”:83,“y”:217}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: touchDown
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][800,1216]
info: [debug] [BOOTSTRAP] [debug] Performing TouchDown using element? false x: 83, y: 217
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Pushing command to appium work queue: [“element:touchUp”,{“x”:83,“y”:217}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:touchUp”,“params”:{“x”:83,“y”:217}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: touchUp
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][800,1216]
info: [debug] [BOOTSTRAP] [debug] Performing TouchUp using element? false x: 83, y: 217
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/perform 200 246.458 ms - 76 {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/perform {“actions”:[{“options”:{“x”:80,“y”:194},“action”:“press”},{“options”:{“ms”:1},“action”:“wait”},{“options”:{},“action”:“release”}]}
info: [debug] Pushing command to appium work queue: [“element:touchDown”,{“x”:80,“y”:194}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:touchDown”,“params”:{“x”:80,“y”:194}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: touchDown
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][800,1216]
info: [debug] [BOOTSTRAP] [debug] Performing TouchDown using element? false x: 80, y: 194
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Pushing command to appium work queue: [“element:touchUp”,{“x”:80,“y”:194}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:touchUp”,“params”:{“x”:80,“y”:194}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: touchUp
info: [debug] [BOOTSTRAP] [debug] Display bounds: [0,0][800,1216]
info: [debug] [BOOTSTRAP] [debug] Performing TouchUp using element? false x: 80, y: 194
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:true,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/perform 200 242.576 ms - 76 {“status”:0,“value”:true,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element {“using”:“class name”,“value”:“android.view.View”}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“class name”,“selector”:“android.view.View”,“context”:“”,“multiple”:false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“class name”,“selector”:“android.view.View”,“context”:“”,“multiple”:false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding android.view.View using CLASS_NAME with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.view.View, INSTANCE=0]
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“ELEMENT”:“3”},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“3”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element 200 64.052 ms - 87 {“status”:0,“value”:{“ELEMENT”:“3”},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/3/size {}
info: [debug] Pushing command to appium work queue: [“element:getSize”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getSize”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“height”:1216,“width”:800},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“height”:1216,“width”:800},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/3/size 200 1479.374 ms - 99 {“status”:0,“value”:{“height”:1216,“width”:800},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/3/location {}
info: [debug] Pushing command to appium work queue: [“element:getLocation”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“y”:0,“x”:0},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“y”:0,“x”:0},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/element/3/location 200 48.207 ms - 85 {“status”:0,“value”:{“y”:0,“x”:0},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/multi/perform {“actions”:[[{“options”:{“element”:“3”},“action”:“press”},{“options”:{“x”:400,“y”:0,“element”:“3”},“action”:“moveTo”},{“options”:{},“action”:“release”}],[{“options”:{“element”:“3”},“action”:“press”},{“options”:{“x”:400,“y”:1216,“element”:“3”},“action”:“moveTo”},{“options”:{},“action”:“release”}]]}
info: [debug] Pushing command to appium work queue: [“element:getLocation”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“y”:0,“x”:0},“status”:0}
info: [debug] Pushing command to appium work queue: [“element:getSize”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getSize”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“height”:1216,“width”:800},“status”:0}
info: [debug] Pushing command to appium work queue: [“element:getLocation”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“y”:0,“x”:0},“status”:0}
info: [debug] Pushing command to appium work queue: [“element:getSize”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getSize”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“height”:1216,“width”:800},“status”:0}
info: [debug] Pushing command to appium work queue: [“element:getLocation”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“y”:0,“x”:0},“status”:0}
info: [debug] Pushing command to appium work queue: [“element:getSize”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getSize”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“height”:1216,“width”:800},“status”:0}
info: [debug] Pushing command to appium work queue: [“element:getLocation”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getLocation”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getLocation
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“y”:0,“x”:0},“status”:0}
info: [debug] Pushing command to appium work queue: [“element:getSize”,{“elementId”:“3”}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:getSize”,“params”:{“elementId”:“3”}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getSize
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“height”:1216,“width”:800},“status”:0}
info: [debug] Pushing command to appium work queue: [“performMultiPointerGesture”,{“actions”:[[{“touch”:{“x”:400,“y”:608},“time”:0.005},{“touch”:{“x”:400,“y”:0},“time”:0.01}],[{“touch”:{“x”:400,“y”:608},“time”:0.005},{“touch”:{“x”:400,“y”:1216},“time”:0.01}]]}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“performMultiPointerGesture”,“params”:{“actions”:[[{“touch”:{“x”:400,“y”:608},“time”:0.005},{“touch”:{“x”:400,“y”:0},“time”:0.01}],[{“touch”:{“x”:400,“y”:608},“time”:0.005},{“touch”:{“x”:400,“y”:1216},“time”:0.01}]]}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: performMultiPointerGesture
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“OK”,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:“OK”,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/multi/perform 200 1350.796 ms - 76 {“status”:0,“value”:“OK”,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/multi/perform {“actions”:[[{“options”:{“x”:400,“y”:600},“action”:“longPress”},{“options”:{“x”:400,“y”:700},“action”:“moveTo”},{“options”:{},“action”:“release”}],[{“options”:{“x”:400,“y”:600},“action”:“longPress”},{“options”:{“x”:400,“y”:500},“action”:“moveTo”},{“options”:{},“action”:“release”}]]}
info: [debug] Pushing command to appium work queue: [“performMultiPointerGesture”,{“actions”:[[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1300},“time”:0.01}],[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1100},“time”:0.01}]]}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“performMultiPointerGesture”,“params”:{“actions”:[[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1300},“time”:0.01}],[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1100},“time”:0.01}]]}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: performMultiPointerGesture
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“OK”,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:“OK”,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/multi/perform 200 185.799 ms - 76 {“status”:0,“value”:“OK”,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/window/current/size {}
info: [debug] Pushing command to appium work queue: [“getDeviceSize”]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“getDeviceSize”,“params”:{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDeviceSize
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:{“width”:800,“height”:1216},“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:{“width”:800,“height”:1216},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← GET /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/window/current/size 200 20.724 ms - 99 {“status”:0,“value”:{“width”:800,“height”:1216},“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/multi/perform {“actions”:[[{“options”:{“x”:400,“y”:600},“action”:“press”},{“options”:{“x”:400,“y”:500},“action”:“moveTo”},{“options”:{},“action”:“release”}],[{“options”:{“x”:400,“y”:600},“action”:“press”},{“options”:{“x”:400,“y”:700},“action”:“moveTo”},{“options”:{},“action”:“release”}]]}
info: [debug] Pushing command to appium work queue: [“performMultiPointerGesture”,{“actions”:[[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1100},“time”:0.01}],[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1300},“time”:0.01}]]}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“performMultiPointerGesture”,“params”:{“actions”:[[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1100},“time”:0.01}],[{“touch”:{“x”:400,“y”:600},“time”:0.005},{“touch”:{“x”:800,“y”:1300},“time”:0.01}]]}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: performMultiPointerGesture
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“OK”,“status”:0}
info: [debug] Responding to client with success: {“status”:0,“value”:“OK”,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← POST /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c/touch/multi/perform 200 197.538 ms - 76 {“status”:0,“value”:“OK”,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: → DELETE /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c {}
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: D:\android\adt-bundle-windows-x86-20140702\sdk\platform-tools\adb.exe -s emulator-5554 shell “input keyevent 3”
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {“value”:“OK, shutting down”,“status”:0}
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] Sent shutdown command, waiting for UiAutomator to stop…
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 40.251
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}
info: ← DELETE /wd/hub/session/e257243e-ca64-4388-a217-8e86e23c1f5c 200 2614.935 ms - 76 {“status”:0,“value”:null,“sessionId”:“e257243e-ca64-4388-a217-8e86e23c1f5c”}

Please let me know if there are any other details you would need to help me out. Good day.


The documentation at the link http://appium.github.io/java-client/io/appium/java_client/TouchAction.html#moveTo(int,%20int) says (x,y) are absolute
screen co-ordinates.


public TouchAction moveTo(int x,
int y)
Move current touch to an absolute position on the screen
Parameters:
x - x coordinate
y - y coordinate
Returns:
this TouchAction, for chaining


However the description in the source code at the link https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/TouchAction.java says the (x,y) are
offset the current touch co-ordinates.


/**

  • Move current touch to a new position relative to the current position on
  • the screen. If the current position of this TouchAction is (xOld, yOld),
  • then this method will move the TouchAction to (xOld + x, yOld + y).
  • @param x change in x coordinate to move through
  • @param y change in y coordinate to move through
  • @return this TouchAction, for chaining
    */
    public TouchAction moveTo(int x, int y) {
    ActionParameter action = new ActionParameter(“moveTo”);
    action.addParameter(“x”, x);
    action.addParameter(“y”, y);
    parameterBuilder.add(action);
    return this;
    }

To debug the issue I enabled the “Pointer location” and “show touch” options under “developer options”. In the old code I have posted for moveTo() i had provided exact co-ordinates on the screen to move the touch from.

TouchAction action0=new TouchAction(driver).longPress(400,600).moveTo(400,700).release();
TouchAction action1=new TouchAction(driver).longPress(400,600).moveTo(400,500).release();
MultiTouchAction mAction=new MultiTouchAction(driver);
mAction.add(action0).add(action1);

Then I changed the moveTo() arguments as offset to current touch as well as the second initial touch co-ordinate slightly different from first one as (410,600). This two corrections together performed the zoom operation successfully.

TouchAction action0=new TouchAction(driver).longPress(400,600).moveTo(0,100).release();
TouchAction action1=new TouchAction(driver).longPress(410,600).moveTo(0,-100).release();
MultiTouchAction mAction=new MultiTouchAction(driver);
mAction.add(action0).add(action1);

The issue with Appiumdriver.zoom(x,y) seem to different as it still doesn’t work for me. But looking at the logs one can examine if something fishy.

I am suspecting MobileElement.zoom() related issue is due to initial touch co-ordinates being same(center of the element).

So I believe there is a need to correct the documentation for moveTo(x,y) ? Not fully aware of the issue with other two cases of zoom described above.

Kindly correct me if you do not agree. Good day.

Regards,
Sandeep Tuppad
https://testinsane.com

even i too tried zoom functionality is not working so i used MultiTouchAction Method its working fine

Just before using zoom and pinch ,
just give a single touch to the element that you need to zoom in or pinch
Here is what i have done and works perfectly…

List imageParent = (List) getDriver().findElements(By.className(“android.support.v4.view.ViewPager”));
WebElement imageChild = imageParent.get(0).findElement(By.className(“android.widget.ImageView”));
firstScreenShot=image.screenshot(imageChild);
int leftX = imageChild.getLocation().getX();
int rightX = leftX + imageChild.getSize().getWidth();
int upperY = imageChild.getLocation().getY();
int lowerY = upperY + imageChild.getSize().getHeight();
int middleY = (upperY + lowerY) / 2;
int middleX = (leftX + rightX) / 2;
TouchAction action0=new TouchAction(getDriver()).press(middleX,middleY).release();
action0.perform();
getDriver().zoom(middleX,middleY);
:wink:

1 Like

Pinch and zoom method are not working as expected for me with Gallery and Google maps application. Nothing happens when zoom is called. Pinch method just scrolls the image. Below is the code I am using to do zoom and pinch.

TouchAction action0=new TouchAction(getDriver()).press(396,532).release();
action0.perform();
mobileView.zoom(396,532);
Thread.sleep(3000);
mobileView.pinch(396,532);

The given x, y coordinates are of center of the screenshot. I have enabled show location option in developer settings to find the locator.

Any help with this issue is greatly appreciated.

1 Like

see https://github.com/appium/java-client/issues/424#issuecomment-228002532 it’s a known bug :expressionless: