Hi I am getting below error:
Error:(60, 15) java: no suitable method found for longPress(org.openqa.selenium.WebElement)
method io.appium.java_client.TouchAction.longPress(io.appium.java_client.touch.LongPressOptions) is not applicable
(argument mismatch; org.openqa.selenium.WebElement cannot be converted to io.appium.java_client.touch.LongPressOptions)
method io.appium.java_client.TouchAction.longPress(io.appium.java_client.touch.offset.PointOption) is not applicable
(argument mismatch; org.openqa.selenium.WebElement cannot be converted to io.appium.java_client.touch.offset.PointOption)
Here is my code:
@Test
public void dragDrop() {
driver.findElementByName(“Basic usage playground”).click();
WebElement ele1 = (WebElement) driver.findElementsById(“com.mobeta.android.demodslv:id/drag_handle”).get(2);
WebElement ele2 = (WebElement) driver.findElementsById(“com.mobeta.android.demodslv:id/drag_handle”).get(5);
TouchAction action = new TouchAction((MobileDriver) driver);
System.out.println(“It Is dragging element.”);
action.longPress(ele1).moveTo(ele2).release().perform();
System.out.println(“Element has been droped at destination successfully.”);
}