public static void pinch(AppiumDriver<?> driver) {
int scrHeight = driver.manage().window().getSize().getHeight(); // To get the mobile screen height
int scrWidth = driver.manage().window().getSize().getWidth();// To get the mobile screen width
MultiTouchAction multiTouch = new MultiTouchAction(driver);
TouchAction touchAction4 = new TouchAction(driver);
TouchAction touchAction3 = new TouchAction(driver);
touchAction3.press(100, 100).waitAction(Duration.ofSeconds(1)).moveTo(scrWidth / 2, scrHeight / 2).release();
touchAction4.press(scrWidth - 100, scrHeight - 100).waitAction(Duration.ofSeconds(1))
.moveTo(scrWidth / 2, scrHeight / 2).release();
multiTouch.add(touchAction3).add(touchAction4);
multiTouch.perform();
}
HERE IS MY PINCH FUNCTION