Performing multiple actions simultaneously in Appium

We can perform multiple actions using MultiTouchAction class in Appium. Below code shows how to add actions to MultiTouchAction class and then perform all actions at the same time.

In below example, we are moving the element e1 to e2 and at the same time moving the element e3 to e4 at the same time. Also note how we have used waitAction which is used to wait for specific period of time.

TouchAction action1 = new TouchAction(driver);
action1.longPress(e1).moveTo(e2).waitAction(100).release();

TouchAction action2 = new TouchAction(driver);
action2.longPress(e3).moveTo(e4).waitAction(100).release();

new MultiTouchAction(driver).add(action1).add(action2).perform();

You may also like...