How to swipe (Left/Right) until a text or element is found.
Does anybody know how to swipe until an element is found?
I tried the below:
JavascriptExecutor js = (JavascriptExecutor) driver;
Map<String, Object> params = new HashMap<>();
params.put("direction", "left");
params.put("element", mobEl.getId());
js.executeScript("mobile: swipe", params);
The above swipes for once.
JavascriptExecutor js = (JavascriptExecutor) driver;
Map<String, Object> params = new HashMap<>();
params.put("element", mobEl.getId());
params.put("direction", "left");
params.put("toVisible", "true");
js.executeScript("mobile: scroll", params);
The above swipes half-way to the next view and heads back to the previous view.
Note: I can write my own version of swipe to left or right by the number of times using a loop to find an element but wondering if there is a default method already like we have on android.
I followed the example from here http://appium.io/docs/en/writing-running-appium/ios/ios-xctest-mobile-gestures/index.html