If somebody looking for solution for Swipe, Scroll for native apps on Android and iOS this is how I achieved
Android
- Based on co-ordinates technique
new TouchAction(driver).press(115, 650).waitAction(ofSeconds(1)).moveTo(115, 350).release().perform();
- Not sure if it’s possible to do with particular element ?
iOS
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap<String, String> swipeObject = new HashMap<String, String>();
-
Method 1
swipeObject.put("element", mobileElementToTakeActionUpon.getId()); swipeObject.put("direction", "up"); js.executeScript("mobile: swipe", swipeObject);
limitation - does more swipe than expected
-
Method 2
swipeObject.put("element", itemsViewTopRow.getId()); swipeObject.put("direction", "down"); swipeObject.put("toVisible", "true"); js.executeScript("mobile: scroll", swipeObject);
-
Co-ordinates based
swipeObject.put("direction", "down"); //up for swipe swipeObject.put("startX", "90"); swipeObject.put("startY", "400"); swipeObject.put("endX", "90"); //"90"); swipeObject.put("endY", "350"); //"200"); swipeObject.put("duration", "2000"); //js.executeScript("mobile: swipe", swipeObject); js.executeScript("mobile: scroll", swipeObject);
limitation - does more swipe than expected
------- Bugs Found during this exercise -------
I hope it helps and in case some info is missing / incorrect please add to thread.
Regards,
Vikram