There's a UIView
in my app. It receives UITouch
-es, and has quite complex logic for their processing. The processing logic depends on UIKit touch interface.
I don't know how to reproduce such case neither with TouchAction
, nor with MultiAction
.
There're 2 touches. touch2 starts later, and lasts shorter:
In the moments t3
and t4
touches move simultaneously, then the touch2 ends, but touch1 still moves.
My current not-working code: https://gist.github.com/gatamar/c7182292a1b54379cc26f3e38c823199
In UIKit, touch events look like this:
touchesBegan: [touch1_t1]
touchesBegan: [touch2_t2]
touchesMoved: [touch1_t3, touch2_t3]
touchesMoved: [touch1_t4, touch2_t4]
touchesEnded: [touch2_t4]
touchesMoved: [touch1_t5]
touchesEnded: [touch1_t5]
Is it possible to achieve this with Appium?
Can MultiAction
perform two non-simultaneous touches?
Is there in Python Appium Client more low-level API e.g. Selenium, XCUITest?
Any help would be greatly appreciated.
Okey then. here is an example of using gestures in Java.
PointerInput finger = new PointerInput(PointerInput.Kind.TOUCH, "finger");
Dimension size = driver.manage().window().getSize();
//get your screen size
Point source = new Point(size.getWidth(), size.getHeight());
//this is resolution of your screen
Sequence pinch = new Sequence(finger, 0);
pinch.addAction(finger.createPointerMove(Duration.ofMillis(0),
PointerInput.Origin.viewport(), source.x / 2, source.y / 2));
pinch.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
pinch.addAction(new Pause(finger, Duration.ofMillis(100)));
pinch.addAction(finger.createPointerMove(Duration.ofMillis(600),
PointerInput.Origin.viewport(), source.x / 3, source.y / 3));
and then you need to perform
that sequense by calling
driver.perform(Arrays.asList(pinchAndZoom1));
As you can see, you might modify duration of gesture, play around it and you will understand how it works. Also here is some docs with examples.