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.