1

How to long press on android record button(during chat) for a particular time duration in appium test, by java. I have tried 3 ways but all are not working, those are:

Way 1:

By pressRecBtn = By.id("recorderButton");
int x = 353;  // x coordinate of device screen, get it after enabling the Show touch and Pointer location from developer option 
int y = 980; // same as x
int timeInMs = 4000;

Action.longPress(driver.findElement(pressRecBtn)).longPress(x, y, timeInMs).perform();

Way 2:

By pressRecBtn = By.id("recorderButton");
int timeInMs = 4000;

Action.longPress(driver.findElement(pressRecBtn)).waitAction(timeInMs).perform();

for this way it's pressed on record button but for a default time(>=1000 MS).

Way 3:

By pressRecBtn = By.id("recorderButton");

Action.longPress(driver.findElement(pressRecBtn)).perform();

This way also working same as way 2.

0

Its working cool!!

By tapOnRecIcon = By.id("btnRecord");    
int timeInMs = 4000;
TouchAction touchAction = new TouchAction((MobileDriver) driver);

touchAction.longPress(driver.findElement(pressRecBtn),timeInMs).release().perform();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.