driver.zoom(element),driver.pinch(element) are not working while automating Android App.It reflects to the home screen i.e. opening notifications and goes to home page…Please let me know if any one knows !!!
did anyone find a solution or an alternative to this?
Not yet…
Hope will get pointers on this…!!!
Thank you in advance,
Bhaskar.
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);
…thanks for suggestion
Unfortunately, touching objects before zoom does not wrok for me. I’m using python client with appium 1.4.15 and xcode 7.1 with iOS 9.1 sim. On the other hand, swipe and flicks actions works correctly.