How to swipe on seekbar? – pCloudy – Question and Answers
Home >> Appium Tricks and Tricks >> How to swipe on seekbar? ...

How to swipe on seekbar?



private void swipeOnSeekbar(AppiumDriver driver, WebElement element, int percentage) {

	Point point = element.getLocation();
	Dimension eleSize = element.getSize();

	int startX = point.getX();
	int startY = point.getY() + (eleSize.getHeight() / 2);
	int moveToX = point.getX() + (eleSize.getWidth() * percentage / 100);
	int moveToY = point.getY() + (eleSize.getHeight() / 2);

	new TouchAction<>(driver).press(PointOption.point(startX, startY))
			.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 *