To execute automated testing using Appium, after the appropriate locator is found, the next step is to perform action on the element.
Though the webdriver specification provides support for certain kind of mobile interaction, its parameters are not always easily mappable to the functionality of the underlying device automation framework.

Appium implements the TouchAction/MultiAction API which helps to build up gestures with multiple actuators. Following are some actions and gestures which can be used on the elements:


The objects of the TouchAction class consist of a series of events. The events are “press”, “release”, “moveTo”, “tap”, “wait”, “longPress”, “cancel” and “perform”. The events take place in a sequence.

A wait event can also be added in between these events to control the timing of the gesture.

The tap event is to tap to an element on the mobile device.

TouchAction touchAction = new TouchAction(driver);
			AndroidElement expandableListsText = driver
					.findElementByXPath("//android.widget.TextView[@text='Expandable Lists']");

The press and longPress events are self-explanatory. These are used to press on an element or press on an element for a longer time duration respectively. To release the press, release event is used.

TouchAction touchAction = new TouchAction(driver);
AndroidElement peopleNamesText = driver
					.findElementByXPath("//android.widget.TextView[@text='People Names']");

The perform event sends the entire sequence of events to Appium and then the gesture is run on the device.

The moveTo event is used to move to an element or to a particular position defined by coordinates.

TouchAction touchAction = new TouchAction(driver);
		AndroidElement hello1Text = driver.findElementByXPath("//*[@content-desc='hello1']");
		AndroidElement hello2Text = driver.findElementByXPath("//*[@content-desc='hello2']");


The objects of MultiTouch are collections of TouchActions. The Multitouch gestures only have 2 methods: add and perform.

add” is used to add another TouchAction to the MultiTouch. Once “perform” is called, all the TouchActions added to the MultiTouch are sent to Appium and performed as if they happened at the same time. Appium first performs the first event of all TouchActions together and then the second.

TouchActions actionOne = new TouchAction();, 10);
actionOne.moveTo(10, 100);
TouchActions actionTwo = new TouchAction();, 20);
actionTwo.moveTo(20, 200);
MultiTouchAction action = new MultiTouchAction();