Appium TouchAction(long press) for 7 second

Hi,for Appium for Android. i use this lines for long press on elements:

//TouchAction class is used for long press on elements

TouchAction action1 = new TouchAction(driver);
String temp = SetUpGeneral.ApplicationPackage+":id/add_sound";
WebElement chat1 = driver.findElementById(temp);
action1.longPress(chat1).release().perform();

Its work good.

the only problem is that i I need long press ( 7 Second ) on the element.
is it possible to set time for long prees ? (like prees for 7 second)

Thanks !

your longPress can receive the element and the duration of press:

https://appium.github.io/java-client/io/appium/java_client/TouchAction.html#longPress-org.openqa.selenium.WebElement-java.time.Duration-

action1.longPress(chat1, Duration.ofMillis(7000)).release().perform();

Thanks !!! :slight_smile:
you helped me alot :slight_smile:

It will also work:-
action1.press(chat1).waitaction(7000).release().perform();