Not able to use needed methods with the latest java-client version: '5.0.4'

Hope anyone can help me with this tough nut.

My framework is:
IntelliJ IDEA
Android 7 emulators from Android studio
Appium 1.7.1
Java 1.8
Gradle project with imported dependencies of java-client version: ‘5.0.4’

I am making automated test for mobile games, in my scripts i’m mixing a lot of methods.
The games are written in the Unity engine so there is no XML UI context.

Until today i used java-client, version: 5.0.0-BETA9 and it worked for me, i just made a script that made taps and swipes in certain x y coordinates in a certain time (witch is not so reliable).
But now i have the need to Use both WebElement and taps/swipes.

in java-client version: ‘5.0.4’ the “driver.findElementByAccessibilityId()” method doesn’t work.
and in java-client, version: 5.0.0-BETA9 the “driver.swipe()” method doesn’t work.

Iv’e tried every version in between and non of them lets both methods work.
in addition to that i can’t even find any working scrolling method that works in any of the versions, and no new documentations for the new updated versions :frowning:

Really need your help!

driver.swipe() is deprecated in the latest versions. Might have to use TouchAction instead.

TouchAction is definitely the way to go. I suggest putting a breakpoint in your test, attaching the Appium Desktop client to your session then testing out your swipe action with the “Swipe By Coordinates” function in the inspector window. You’ll be able to see the TouchAction commands in the server output.

Thanks for the suggestion :slight_smile:
I’ll try it out.
but why did they complicate everything so much?.. the driver.swipe() was a great and easy to use method.

1 Like

I can not use the inspector window because i’m using a non GUI appium from the command prompt.

The next method is working, but only with relative coordinates and not exact coordinates like i used to work with.
so this one is doing the job:

newTouchAction(driver).longPress(relative x, relative y).moveTo(relative x, relative y).release().perform);

1 Like

the previous driver.swipe actually wrapped the TouchAction in very basic way. in many cases eventually you would find yourself build your own swipe logic … probably appium’s team have realize that and they decided to remove swipe support.

TouchAction API provides you many different ways to implement your flow , just need to be familiar with the full API and it’s capabilities.
You would also may want to use Dimensions , Size , Location APIs for better coordinates calculation.

In addition , in my team we have developed an external tool which is uses TouchActions API , apple scripts and Java Robot SDK , and allows you to perform complex gestures (something which was broken in latest appium / XCUITest ver)

The sky is the limit :slight_smile:

Good Luck


You can attach the desktop client to any server session. Start the desktop server on another port than your server started from your shell, launch the inspector, click Attach to Session then provide the target remote port…

1 Like