For a few days I try to find a simple solution for scroll inside a list view
Since that Appium Inspector not provide the all elements of the list (only by manualy swipe and refresh the inspector then the new elements with the new instance loads.
After research i find out the distance between list item is as follow:
Item Location= (15, 828)
Item Location= (15, 1209)
Item Location= (15, 1590)
So i guess that every click need to scroll 381 pixels down, after so many tries I cannot find solution for this part of code and will be happy if someone can help with that:
List<WebElement> list = driver.findElements(By.id("net.balink.diplomat.qa:id/btnAddToCart"));
System.out.println("List Size is= " + list.size());
for (int j = 0; j < list.size(); j++) {
WebElement listItem = list.get(j);
Point location = listItem.getLocation();
System.out.println("Location= " + location);
listItem.click();
//to do here: swipe 381 px down after any click, then re-initialize
//the listItem in order to get a new index - and the loop when
//theres no more list items
Thread.sleep(2000);
}