TouchAction gestures not working with Java client 5.0.0Beta on iOS

Hi,

I am trying to perform gestures present in TouchAction on iOS device using the below code:

Press an element:

TouchAction action = new TouchAction(Launcher.getDriver());
action.press(element).perform();

Swipe on screen(vertical-up):

    Dimension size=getScreenSize();
	int middleX=size.width/2;
	int lowerY=(int) ((size.height)*0.80);
	int upperY=(int) ((size.height)*0.20);
	
	action.longPress(middleX, upperY).moveTo(middleX, upperY).release().perform();

but it is throwing the error as:

org.openqa.selenium.WebDriverException: Support for this gesture is not yet implemented. Please contact an Appium dev (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 203 milliseconds
Build info: version: ‘unknown’, revision: ‘unknown’, time: ‘unknown’
System info: host: ‘Apples-MacBook-Pro-3.local’, ip: ‘10.149.34.50’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.12.1’, java.version: ‘1.8.0_111’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{app=/Users/apple/Documents/P2PWorkspace/P2PAuto/P2P619.ipa, networkConnectionEnabled=false, noReset=true, databaseEnabled=false, deviceName=TDBank’s iPhoneN, platform=MAC, realDeviceLogger=/usr/local/lib/node_modules/deviceconsole/deviceconsole, platformVersion=10.1.1, webStorageEnabled=false, locationContextEnabled=false, automationName=XCUITest, browserName=, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, udid=6a48a007a301c5b4058cdf9a90fd5a6edb0a5819}]
Session ID: 0b75add6-6e8d-4190-a60a-b0c77b790ebe
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at io.appium.java_client.PerformsTouchActions.performTouchAction(PerformsTouchActions.java:39)
at io.appium.java_client.TouchAction.perform(TouchAction.java:381)
at pkg.master.MobileAction.Press(MobileAction.java:146)
at pkg.master.Pages.tdHomeScreen.clickMenu(tdHomeScreen.java:30)
at pkg.master.TestCase.testCase2(TestCase.java:27)
at pkg.master.TestCase.executor(TestCase.java:16)
at pkg.master.Launcher.setup(Launcher.java:61)
at pkg.master.Main.main(Main.java:8)

try:

// 1
TouchAction action = new TouchAction(Launcher.getDriver());
action.press(element).release().perform();
//2
action.press(middleX, upperY).waitAction(Duration.ofSeconds(2)).moveTo(middleX, upperY).release().perform();

For Press it is working. but swipe is still not working

What are you swiping with long press?

I want to swipe in my application. The swipe method you provided is working for swipe_down but it is not working for other swipes e.g. swipe_up, swipe_right, swipe_left.

you was asking for longPress in code. that is why i gave you working longPress.

“action.longPress(middleX, upperY)”

if you want to swipe with iOS it is easier to use:

public boolean swipeToDirection_iOS_XCTest(MobileElement el, String direction) {
        try {
            JavascriptExecutor js = (JavascriptExecutor) driver;
            HashMap<String, String> swipeObject = new HashMap<String, String>();
            if (direction.equals("d")) {
                swipeObject.put("direction", "down");
            } else if (direction.equals("u")) {
                swipeObject.put("direction", "up");
            } else if (direction.equals("l")) {
                swipeObject.put("direction", "left");
            } else if (direction.equals("r")) {
                swipeObject.put("direction", "right");
            }
            swipeObject.put("element", el.getId());
            js.executeScript("mobile:swipe", swipeObject);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

it failed with below error on terminal

[debug] [MJSONWP] Calling AppiumDriver.execute() with args: [“mobile:swipe”,[{“direction”:“up”,“element”:“20B382D4-8837-4717-9432-1D198F2FADF3”}],“53afc23a-f8b7-48cd-b65e-eb04c7c43f0b”]
[debug] [XCUITest] Executing command ‘execute’
[HTTP] ← POST /wd/hub/session/53afc23a-f8b7-48cd-b65e-eb04c7c43f0b/execute 500 440 ms - 159

your appium version should be at least 1.6.5 is it?