Appium press() and longPress() samples

With Android 12, the Samsung Messages app has introduced the feature of a so-called long press that allows moving images or text. Clicking an image or text with a long press of 500 ms still opens the menu, but if you apply a longer press, the menu opens and closes immediately, and you can then move the clicked object to a different location on the screen.

To handle this new functionality in your Appium automation scripts, you can use the press() or longPress() functions with duration handling. This functionality has been tested and is working with Perfecto.

Copy

longPress() example

action.longPress(LongPressOptions.longPressOptions().withElement(ElementOption.element(myElement)).withDuration(Duration.ofMillis(500))).release().perform();
Copy

press() example

action.press(PointOption.point(clickX, clickY)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(500))).release().perform();