How to scroll horizontal using touch action?

here i have attached images to let you know about app page. please help me to generate script for horizontal scroll and click.
i want to scroll from “add text” to “text art”.
generate script or code for better understanding

.

What is your programming language?

@tuonghm : its java. i am testing using appium. i know how to scroll vertical and swipe but don’t know how to scroll horizontal.

Please try it:
In MobileActions class:

public class MobileActions {

private IOSDriver driver;
public MobileActions(IOSDriver driver) {
this.driver = driver;
}

private TouchAction _touchAction;
private TouchAction touchAction() {
if (_touchAction == null) {
_touchAction = new TouchAction(driver);
}
return _touchAction;
}

public void swipeOnScreen(Point fromPoint, Point toPoint) {

WaitOptions waitOptions = new WaitOptions().withDuration(Duration.ofMillis(300));
touchAction().press(new PointOption().withCoordinates(fromPoint)).waitAction(waitOptions).moveTo(new PointOption().withCoordinates(toPoint)).waitAction().release().perform();
}
}

Use it:

IOSElement startElement = (IOSElement) driver.findElementById(“add text”);
IOSElement endElement = (IOSElement) driver.findElementById(“text art”);

swipeOnScreen(startElement.getLocation(), endElement.getLocation());

Or you can swipe Element with direction:

public enum Direction {
TOP, RIGHT, BOTTOM, LEFT
}
public void swipeElementWithDirection(AndroidElement element, Direction direction) {

double endXPercen = 0.9;
int startX, startY, endX, endY;

int screenWidth = driver.manage().window().getSize().width;
int screenHeight = driver.manage().window().getSize().height;

switch (direction) {
case TOP:
startX = element.getCenter().getX();
startY = element.getSize().getHeight();

endX = startX;
endY = screenHeight - (int) (screenHeight * endXPercen);
break;
case RIGHT:
startX = element.getCenter().getX();
startY = element.getCenter().getY();

endX = (int) (screenWidth * endXPercen);
endY = startY;
break;
case LEFT:
startX = element.getSize().getWidth();
startY = element.getCenter().getY();

endX = screenWidth - (int) (screenWidth * endXPercen);
endY = startY;
break;

default:
startX = element.getCenter().getX();
startY = element.getLocation().getY();

endX = startX;
endY = (int) (screenHeight * endXPercen);
break;
}

Point startPoint = new Point(startX, startY);
PointOption startPointOption = new PointOption().withCoordinates(startPoint);

Point endPoint = new Point(endX, endY);
PointOption endPointOption = new PointOption().withCoordinates(endPoint);

WaitOptions waitOptions = new WaitOptions().withDuration(Duration.ofMillis(500));

Log.addLog("Start Point: " + startPoint + " and End point: " + endPoint);
touchAction().press(startPointOption).waitAction(waitOptions).moveTo(endPointOption).waitAction().release().perform();

}

---- Use it:

IOSElement startElement = (IOSElement) driver.findElementById(“id”);
swipeElementWithDirection(startElement, Direction.RIGHT);

it’s hard to understand code as i am new in appium automation. though i will try. but it can be more helpful if you can suggest me any video link.

http://appium.io/docs/en/writing-running-appium/touch-actions/

I hope it can help you.

TouchAction().press(el0).moveTo(el1).release()

Or sample project:

my skype: [email protected]
good luck!