appium icon indicating copy to clipboard operation
appium copied to clipboard

Deprecate TouchAction and MultiTouchAction

Open KazuCocoa opened this issue 4 years ago • 6 comments

The problem

Selenium v4 no longer has them. We'd also like to drop them and follow W3C actions. Related to: https://github.com/appium/appium/pull/16004

Probably we should make them deprecate first, and prepare migration guides, and remove them completely. (I think old automation tools like uia1 still only has old touch/multitouch actions, so I guess we should deprecate them first)

  • Ruby
  • Python
  • Java
  • .NET

KazuCocoa avatar Oct 25 '21 21:10 KazuCocoa

@KazuCocoa @mykola-mokhnach is ActionChains really the best (only?) option for touch actions on mobile now that TouchAction is deprecated? I'm just now looking at these APIs and it doesn't look like this will be a seamless transition. There doesn't seem to be way to click an x,y location or even long pressing. Are there any plans for appium client libraries adding mobile specific w3c actions?

JoelWhitney avatar Dec 16 '21 17:12 JoelWhitney

@JoelWhitney Hmm thats true, would be nice to know how to handle such usecases in the future.

RSM-SBA avatar Dec 17 '21 08:12 RSM-SBA

Appium also provide gesture actions by each platform as below. e.g. https://github.com/appium/appium-uiautomator2-driver#mobile-gesture-commands https://github.com/appium/appium-xcuitest-driver#mobile-tap

Some clients have w3c action examples to help w3c actions. Python client replaced shortcut methods with W3C based one. Uses who use them do not need to consider the backend, possibly. Others depend on each client development. https://github.com/appium/ruby_lib_core/blob/master/CHANGELOG.md#deprecations-1 https://github.com/appium/python-client#quick-migration-guide-from-v1-to-v2

Are there any plans for appium client libraries adding mobile specific w3c actions?

I guess you're saying shortcuts such as swipe etc, that is built by primitive w3c actions. Since Appium 2.0, you can use plugin feature to add your own route. For example, https://github.com/AppiumTestDistribution/appium-gestures-plugin tries to add new routes as shortcuts of gustier. Appium provides W3C spec methods as its base implementation, and plugins can add shortcuts.

KazuCocoa avatar Dec 17 '21 08:12 KazuCocoa

@JoelWhitney Got a point click action which swipes down to refresh the page.

` PointerInput finger = new PointerInput(org.openqa.selenium.interactions.PointerInput.Kind.TOUCH, "finger");

		Sequence swipeDown = new Sequence(finger, 1);
		swipeDown
		.addAction(finger.createPointerMove(Duration.ZERO, Origin.viewport(), deviceWidth/2,deviceHeight/2))
		.addAction(finger.createPointerDown(MouseButton.LEFT.asArg()))
		.addAction(finger.createPointerMove(Duration.ofMillis(700), Origin.viewport(), deviceWidth/2,deviceHeight/2+deviceHeight/3))
		.addAction(finger.createPointerUp(MouseButton.LEFT.asArg()));
		driver.perform(Arrays.asList(swipeDown));

`

RSM-SBA avatar Dec 17 '21 09:12 RSM-SBA

Any possibility to execute ios "long press" type of action with W3C actions?

I tried this, with no luck.

PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Sequence dragNDrop = new Sequence(finger, 1);
dragNDrop.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), sourceP.x, sourceP.y));
dragNDrop.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
dragNDrop.addAction(new Pause(finger, Duration.ofMillis(600)));
dragNDrop.addAction(finger.createPointerMove(Duration.ofMillis(700), PointerInput.Origin.viewport(), targetP.x, targetP.y));
dragNDrop.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
webdriver.perform(Collections.singletonList(dragNDrop));

sobolewska avatar Mar 15 '22 15:03 sobolewska

@sobolewska yes something like this should work, this is not a long press though, this is more of a drag and drop. also 600ms is probably not long enough.

jlipps avatar Mar 17 '22 19:03 jlipps

.NET is also in the loop now, thanks to https://github.com/appium/appium-dotnet-driver/pull/548

Dor-bl avatar Nov 07 '22 16:11 Dor-bl

thank you

KazuCocoa avatar Nov 07 '22 17:11 KazuCocoa