This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 7
Apr 2018

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!

MobileElement element = driver.findElement(By.id(“btnA”));
for(int i=1; i<11; i++) {
element.click();
}

  • created

    Apr '18
  • last reply

    Apr '18
  • 6

    replies

  • 752

    views

  • 3

    users

  • 1

    like

  • 3

    links

Why do you want to do 10 taps in quick succession ? Is this valid user story at all ?

Till date didn’t come across any app which needs such actions :grinning:

Thanks for your reply, it’s a valid user story for my case, and it would be great if anyone could give me some idea how to do it. THANK YOU!

@yitelu last time i needed similar i used following approach.

  • tap by element IS slow thus use tap by X, Y!
  1. find element
  2. get is center x,y
  3. now tap 10 times using x,y - it is times faster then by element (which involves element search first)

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();

 TouchAction action = new TouchAction(driver);

 for(int i=1; i<11; i++){
             action.tap(startX, startY);
 }