I have a scenario to test an IOS app like this:
- long press on an element.
- move that element to desired location.
I am using the following code:
TouchAction action = new TouchAction(driver)
action.long_press(element1).move_to(element2).wait(500).release().perform()
but its not working for me. Need any good suggestion.
i was in trouble also about this. But i solved this like below:
TouchAction action = new TouchAction(driver);
action.longPress(elem1).waitAction(3000).moveTo(elem2).perform().release();
waitAction
will wait to complete longPress
action and then moveTo
action will perform.
I found none of the longPress() combinations to work, so I got to this variant where you force it to perform the press and then move. Tested on Android and iOS, didn't seem to work for UWP
new TouchAction(driver)
.press(PointOption.point(256, 1115))
.waitAction(WaitOptions.waitOptions(Duration.ofMillis(2000)))
.perform()
.moveTo(PointOption.point(256, 600))
.release()
.perform();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With