Touch actions failing for android automation after upgrading from appium 2.1 to latest 2.5 version

Hi Team,

In case of Android Automation - Client is dot net and I am using uiAutomator [email protected] and Appium server 2.1 version and I am able to perform the automation successfully but while upgrading to 2.5 version of Appium, actions like touch, spread, pinch etc. are not working and I know the reason that Touch Action classes has been deprecated.

On the flip side, For IOS, similarly, I upgraded the Appium version from 2.1 to 2.5 and there we are using xcuiTest driver and there I am able to perform the automation without any issue on the latest version of appium which is 2.5

I would like to know the root cause in case of Android automation why it is failing. Is it happening because of Touch actions deprecated classes or uiAutomator can also be the reason behind it?

Kindly assist me for the same.

check this: UnsupportedCommandException: Unhandled endpoint error displayed when performing touch operations - #3 by ido_oserovitz

@ido_oserovitz I am using dot net client and i used Touch actions and with respect to that my code was working fine until i had the version of Appium server to 2.5.1 and uiAutomator2 version to 2.45.1 and uiAutomatorServer to 6.0.9 but few days back i upgraded uiAutomator2 to 3.1.0 which is latest one and code was not working as expected because touch action classes has deprecated.

Now i again degrade the uiAutomator2 version to 2.45.1 , still code is not working as expected which was working earlier. Is any other software also got impacted during upgration which i need to downgrade too ?

Kindly assist

Hi

From iOS side touchActions() deprecated. You can use action or performAction() in place of touchAction().If you upgrade touchActions will not work.

I am also facing the same touch action issue. I know that the Touch Action classes have been deprecated. Could you suggest a class or provide a sample code instead of touch actions? Let me explain what I’m trying to do: I’m using Appium version 2.5.3 with Java, and I’m attempting to scroll up a webpage in the mobile Chrome browser.

please follow this document How to automate gestures testing using W3 Actions API in Appium? (devstringx.com)

am now able to scroll the page Her challenging part is need to scroll by webelement. her I using scrollToWebelementView is not working appium 2.5.4.
I need to scroll to each gate by gate numbers please suggest me. below reference images added please check.


Hi @Munishhh Is there a actual ‘overview guide’ that explains why the new W3C actions are ‘easier’ that TouchActions. Because when I read the code they are about 30% more code, and so I find that claim impossible to believe. But mainly what is the underlying pattern to explain them that works to understand not just how to solve one problem with the new standard, but how it is a better standard for understanding all the new W3C actions in our test code?

These are probably better questions for @mykola-mokhnach, however, if I may:

I believe the answer to your question is that Appium is striving to be compliant with it’s ‘parent’, Selenium. There is a nice overview of the changes in Selenium 4 here:

Of note:

  • Actions API in WebDriver W3C Protocol are richer in comparison to the one in JSON Wire Protocol. The Actions API is revamped to conform with the WebDriver Spec. Action APIs would now let you perform multi-touch actions, zoom-in, zoom-out, pressing two keys simultaneously, and more.
    For example, the Pinch-zoom sequence in W3C Protocol is represented by an action sequence consisting of three ticks and two-pointer devices of type-touch.

I hope that helps.

1 Like

It sure does Wreed.
It’s always been puzzling how mobile automation tooling differs so much from desktop where all kinds of RPA (Rapid process automation) tools that do work well flood the scene, so the JSON wire protocol limits always felt like automation for web and mobile was just plain broken. The new API is more code, but it’s definitely the power I was lacking. Users just need to write wrappers for each action now really.

Been out of the mobile-automation loop a bit this year and now we have a new project I refreshed and started fixing old tests, and when we updated to new drivers I realised how overdue my test framework was for a big clean-up. One of our teams is already moving their tooling over to Selenium 4, probably a good time to talk.

Oh, just for completeness here @lokeshwar_jakkula the strategy I often use is to start a loop, and keep scrolling until the element you want is in view, each time you loop, you have to perform a swipe up.
Example code here is Python

// :param max_swipes: typically 20
swipes_remain = max_swipes
error = None
while swipes_remain:
try:
if element_to_find().is_displayed():
return True
except Exception as e:
error = e
# perform some short upward swipes
size = element_parent().size
location = element_parent().location
PageObject.log.log(f"ActionChain Tap and move from ({floor(size[‘width’]/2)+location[‘x’]}, {floor(size[‘height’]/2)+location[‘y’]}) "
“\n click and hold relative-motion ({0}, {-int(size[‘height’]/4)})”)
ac = ActionChains(self.ui.driver)
try:
ac.move_to_element(element_parent()).move_by_offset(0, int(size[‘height’]/4)).click_and_hold().
move_by_offset(0, -int(size[‘height’]/4)).release().perform()
except Exception as ex:
PageObject.log.log(f"swipe_up_to_entry() handled a {type(ex).name}")
swipes_remain -= 1
raise error