doc - https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/ios-xctest-mobile-gestures.md
actually:
[XCUITest] Error: Mobile scroll supports the following strategies: name, direction, predicateString, and toVisible. Specify one of these
as you see "element" is missing and it is true - https://github.com/facebook/WebDriverAgent/blob/master/WebDriverAgentLib/Commands/FBElementCommands.m
BUT thanks for question! i updated mine code more easy.
mine previous working approach ( i just scroll slightly until element becoming visible):
public Boolean tapRequestByDescription(String descr) {
System.out.println(" tap request by description: " + descr);
MobileElement el = (MobileElement) ((IOSDriver) driver).findElementByIosNsPredicate("value = '" + descr + "'");
int y;
if (el != null ) {
y = el.getCenter().getY();
while (y <= 0) {
scrollToDirection_iOS(mainContainer.get(0), "u", 120);
y = el.getCenter().getY();
}
try {Thread.sleep(700);} catch (Exception e) {}
return tapElement(el);
}
return false;
}
now i changed to:
public boolean tapPaymentByDescription(String text) {
System.out.println(" tapPaymentByDescription(): " + text);
JavascriptExecutor js = (JavascriptExecutor) driver;
HashMap scrollObject = new HashMap<>();
scrollObject.put("predicateString", "value == '" + text + "'");
js.executeScript("mobile: scroll", scrollObject);
WebElement el = ((IOSDriver) driver).findElementByIosNsPredicate("value = '" + text + "'");
return tapElement((MobileElement) el);
}