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

**URL:** <https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336>\
**Category:** Support\
**Created:** [October 25, 2017, 2:31pm UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336 "2017-10-25T14:31:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lina](https://discuss.appium.io/user_avatar/discuss.appium.io/lina/32/3984_2.png) [@lina](https://discuss.appium.io/u/lina)\
**Post date:** [October 25, 2017, 2:31pm UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/1 "2017-10-25T14:31:22Z")

</div>

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.

**THE PROBLEM:**  
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 ☹

Really need your help!

---

<div class="post-metadata">

**Author:** ![PoornimaSuraj](https://discuss.appium.io/user_avatar/discuss.appium.io/poornimasuraj/32/6360_2.png) [@PoornimaSuraj](https://discuss.appium.io/u/PoornimaSuraj)\
**Post date:** [October 25, 2017, 3:27pm UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/2 "2017-10-25T15:27:53Z")

</div>

driver.swipe() is deprecated in the latest versions. Might have to use TouchAction instead.[https://appium.readthedocs.io/en/stable/en/writing-running-appium/touch-actions/](https://appium.readthedocs.io/en/stable/en/writing-running-appium/touch-actions/)

---

<div class="post-metadata">

**Author:** ![jarmy](https://discuss.appium.io/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@jarmy](https://discuss.appium.io/u/jarmy)\
**Post date:** [October 25, 2017, 10:15pm UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/3 "2017-10-25T22:15:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lina](https://discuss.appium.io/user_avatar/discuss.appium.io/lina/32/3984_2.png) [@lina](https://discuss.appium.io/u/lina)\
**Post date:** [October 26, 2017, 10:34am UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/4 "2017-10-26T10:34:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lina](https://discuss.appium.io/user_avatar/discuss.appium.io/lina/32/3984_2.png) [@lina](https://discuss.appium.io/u/lina)\
**Post date:** [October 26, 2017, 10:37am UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/5 "2017-10-26T10:37:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lina](https://discuss.appium.io/user_avatar/discuss.appium.io/lina/32/3984_2.png) [@lina](https://discuss.appium.io/u/lina)\
**Post date:** [October 26, 2017, 4:46pm UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/6 "2017-10-26T16:46:48Z")

</div>

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);

---

<div class="post-metadata">

**Author:** ![igal\_epshtein](https://discuss.appium.io/user_avatar/discuss.appium.io/igal_epshtein/32/5422_2.png) [@igal\_epshtein](https://discuss.appium.io/u/igal_epshtein)\
**Post date:** [October 26, 2017, 7:49pm UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/7 "2017-10-26T19:49:34Z")

</div>

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 🙂

Good Luck

---

<div class="post-metadata">

**Author:** ![jarmy](https://discuss.appium.io/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@jarmy](https://discuss.appium.io/u/jarmy)\
**Post date:** [October 26, 2017, 8:34pm UTC](https://discuss.appium.io/t/not-able-to-use-needed-methods-with-the-latest-java-client-version-5-0-4/19336/8 "2017-10-26T20:34:26Z")

</div>

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…
