How to perfrom Long press operation in Andriod devices? – pCloudy – Question and Answers
Home >> Appium Tricks and Tricks >> How to perfrom Long press operation in ...

How to perfrom Long press operation in Andriod devices?


Code Snippet:

//Appium Version: 1.12.0
//Java-Client:7.0.0

MobileElement webElement=driver.findElement(By.xpath("//android.widget.RelativeLayout[@resource-id='com.fortysevendeg.android.swipelistview:id/front']"));
    LongPressOptions longPressOptions = new LongPressOptions();
    longPressOptions.withDuration(Duration.ofSeconds(4)).withElement(ElementOption.element(webElement));
    new TouchAction(driver).longPress(longPressOptions).perform();

Leave a Reply

Your email address will not be published. Required fields are marked *