Hi Rjimms,
This code works fine on both Android and iOS. To make it run on iOS, one has to club XPath with visible property.
public static void iOSSwipe(String xPath) {
do {
try {
driver.findElement(By.xpath(xPath)).click();
break;
} catch (Exception NoSuchElementException) {
Dimension dimensions = driver.manage().window().getSize();
Double screenHeightStart = dimensions.getHeight() * 0.5;
int scrollStart = screenHeightStart.intValue();
Double screenHeightEnd = dimensions.getHeight() * 0.2;
int scrollEnd = screenHeightEnd.intValue();
driver.swipe(0, scrollStart, 0, scrollEnd, 2000);
}
} while (true);
}
Example Call statement - iOSSwipe("//*[@label='Gift Cards' and @visible='true']");
Thanks