down vote
favorite
I am new to appium and using its version 1.7
i have to long press a webelement in my native app on android version 7.0 It shows all the methods are depreciated except for longPress(LongPressOptions longpressoptions) and longPress(PointOption longpressoptions). so i started using it like below
I am using it like below
public static RemoteWebDriver driver;
driver = new RemoteWebDriver(new URL(“http://0.0.0.0:4723/wd/hub”), capabilities);
WebElement homeScrSwipe = driver.findElementById(“pulldown_image”);
TouchAction ta = new TouchAction((PerformsTouchActions) driver);
ta.longPress(homeScrSwipe, Duration.ofMillis(5000)).release().perform();
but it always gives me below error
The method longPress(WebElement, Duration) from the type TouchAction is deprecated.
If someone could let me know what is this longPressOptions in both the methods and what arguments to provide that would be of great help
@Telmo_Cardoso, @Nemanja_Maksic, @mohak.barokar
I tried it like below but that did not perform any action. Any Advice for below code ?
Dimension sz = driver.manage().window().getSize();
int xloc = sz.getWidth() / 2;
int yloc = sz.getHeight() / 2;
TouchAction ta = new TouchAction((PerformsTouchActions) driver);
ta = ta.tap(TapOptions.tapOptions().withPosition(PointOption.point(xloc, yloc)));
ta.release().perform();