Hi All,
I would like to perform 10 quick clicks action on a button in an Android app (prefer 0.5s), but following 10 clicks’ gap is too long (approx 1.5 sec gap). Wondering what is the proper way to shorten the gap between each click in Appium Java?
I’ve tried findElement by xpath, but still no luck, wondering if there’s any other way? or it’s just simply the limitation of Appium for now? (btw i’m using io.appium 6.0.0-BETA4)
THANK YOU in advance!
Hi @Aleksei ,
Thanks for your reply. it seems that TouchAction tap is deprecated, wondering if you know other method? or wondering if you could share how to implement it?
THANK YOU
here’s my code attempts:
WebElement webElement = driver.findElement(By.xpath("//android.widget.TextView[@index=‘1’]"));
int startX=webElement.getLocation().getX();
int startY=webElement.getLocation().getY();
@Aleksei
I also needed to tap on a textView 10 times for a use case and tried both the TouchAction & MultiTouchAction with the below code.
Solution 1: Using TouchAction class
TouchAction action = new TouchAction(driver);
int startX=mobEl.getLocation().getX();
int startY=mobEl.getLocation().getY();
for(int i=1; i<11; i++){
action.tap(PointOption.point(startX,startY)).perform();
}
Solution 2: Using MultiTouchAction class
MultiTouchAction multiTouch = new MultiTouchAction(driver);
int startX=mobEl.getLocation().getX();
int startY=mobEl.getLocation().getY();
for (int i = 0; i < 10; i++) {
TouchAction tap = new TouchAction(driver);
multiTouch.add(tap.press(PointOption.point(startX, startY)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(400))).release());
}
multiTouch.perform();
@Aleksei The solution 1 you see above works on my Android but it does not work on iOS.
The script finds elements and taps on it but no feedback from the app. Do you have any idea?