Hi all
I have a list of elements (each element have strings, image and button)
and the list is scrollable
I need to get all of items without duplicating
I tried a code like this
but its skipped some elements
val itemsSet: MutableSet = hashSetOf()
var previousSetSize: Int
do {
previousSetSize = itemsSet.size
if (previousSetSize != 0) {
Scroll.scroll(Scroll.Direction.DOWN)//function to scroll down
}
val displayedItems = driverInstance.findElements(By.id("item_id")) as List<WebElement>
displayedItems.forEach {
if (itemsSet.contains(it))
return@forEach
itemsSet.add(it)
} while (previousSetSize != itemsSet.size)
I checked on Appium inspector, when scroll the screen, some of new element take same ids for previous elements