How Swipe UP on the Element? – pCloudy – Question and Answers
Home >> Appium Tricks and Tricks >> How Swipe UP on the Element? ...

How Swipe UP on the Element?



public void swipeUPOnElement(WebElement element) {
Point point = element.getLocation();
Dimension eleSize = element.getSize();
int centerX = point.getX() + (eleSize.getWidth() / 2);
int centerY = point.getY() + (eleSize.getHeight() / 2);
int moveToX = point.getX() + (eleSize.getWidth() / 2);
int moveToY = point.getY();

new TouchAction(driver)
.press(PointOption.point(centerX,centerY))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(1000)))
.moveTo(PointOption.point(moveToX, moveToY))
.release().perform();
}

Leave a Reply

Your email address will not be published. Required fields are marked *