In the documentation, appium presents the following option for java:
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, Double> swipeObject = new HashMap<String, Double>();
swipeObject.put("startX", 0.01);
swipeObject.put("startY", 0.5);
swipeObject.put("endX", 0.95);
swipeObject.put("endY", 0.5);
swipeObject.put("duration", 1.8);
js.executeScript("mobile: swipe", swipeObject);
I integrated this in my test, but after navigating to the screen where swipe would be available, the method with swipe won't perform the action... In the failure exception panel I receive the following error: "org.openqa.selenium.WebDriverException: Not yet implemented".
I want to swipe from left to right, but did not find another solution yet...
UPDATE: I have managed to swipe by using the following code:
HashMap scrollObject = new HashMap();{{
scrollObject.put("direction", "left");
}};
((RemoteWebDriver) driver).executeScript("mobile: scroll", scrollObject);
The problem is, that it will only swipe once, even if used multiple times... any ideas on how to solve this?
How about using IOSDriver (driver) and calling the following:
please refer detailed RCA of this issue with solution
Issue is for iOS appium java client had implmeneted swipe function differently!
for Android it stands with their parameter names endx and endy which are end point coordinates!
But for iOS they are deltaX and deltaY if named correctly.
in nutshell,
StartX and StartY are coordinates of your start point of the stroke!
Lets take example