How to automate 3 finger touch at a same time using appium driver in java?

  1. I need to automate multi touch action for iOS app.In the iOS app, I have certain function, enable admin mode
    context,I will enable admin mode by keeping three fingers vertically exactly on the text “powered By enable” for 3 seconds.

  2. I don’t know, whether it is possible to automate this operation using appium driver.

  3. I have tried with below coding for multitouch action.

  4. By using below code , touch action occurs for me, but not in the same time. It
    occurs one by one. I need to automate three fingers touch at a time.

WebElement el= driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[5]/UIAStaticText[1]"));
MultiTouchAction multiTouch = new MultiTouchAction(driver);
TouchAction action0 = new TouchAction(driver).tap(el);
TouchAction action1 = new TouchAction(driver).tap(el);
TouchAction action2 = new TouchAction(driver).tap(el);

  1. your example not clear. you touching same place with 3 figures. In real world it is one touch.
  2. in real life you always start touching one by one.

try something like:

        WebElement el1 = driver.findElement("id1"));
        WebElement el2 = driver.findElement("id2"));
        WebElement el3 = driver.findElement("id3"));
        MultiTouchAction multiTouch = new MultiTouchAction(driver);
        TouchAction action1 = new TouchAction(driver);
        TouchAction action2 = new TouchAction(driver);
        TouchAction action3 = new TouchAction(driver);, 0).release();, 0).release();, 10).release();
1 Like

@Aleksei, I will explain clearly, First I will place my 3 fingers in the “text” at a time for 3 seconds, after that it will show a message as “Admin mode is active”. If keep three fingers at a time on the text only, it will enable admin mode. If I perform touch action one by one means, it wouldn’t enable admin mode.I need to automate this touch operation. Is there any way to automate this multi touch gesture?

Are you putting your fingers on top of each other? In you code you putting fingers into same place (e.g. x = 100, y = 100 ) = one finger.

If you want to put 3 fingers on some element - you need provide 3 different coordinates.
thus your code should be something like:

        int x  = driver.findElement("id1")).getLocation().getX();
        int y  = driver.findElement("id1")).getLocation().getY();
        MultiTouchAction multiTouch = new MultiTouchAction(driver);
        TouchAction action1 = new TouchAction(driver);
        TouchAction action2 = new TouchAction(driver);
        TouchAction action3 = new TouchAction(driver);,y+2).waitAction(3500).release(); //3.5sec for sure, 2 pixels inside el,y+4).waitAction(3500).release(); //3.5sec for sure, 4 pixels inside el,y+6).waitAction(3500).release(); //3.5sec for sure, 6 pixels inside el
1 Like

@Aleksei, Ok I will try above code.

@Aleksei, I need one clarification regarding above code. I have tried with above code, it highlights the particular text alone. According to my scenario,

  1. I will keep my three fingers at a time on the text, according to the above code, it will press at 2 pixels and wait for 3500 second and then it will release the action and the same action repeated for another pixels also, Am I correctly interpreted with above code?

  2. But I want to press with 3 fingers for 3500 seconds together and then I need to release() and perform(). Can you provide the solution for this?

it should tap simultaneously all 3 actions otherwise it is issue in Appium or Android UIAutomator tool.
try to play like(just added slightly move):,y+2).waitAction(3500).moveTo(1,0).waitAction(3500).release();

Hi Aleksei, I want to automate 2 finger zoom and pan gesture using c# code… Can you please help me here with the code…i am new to appium and struggling alot with these two multi finger gestures…

@Dipti_Shetty please check this