How to fetch unique items from a list of items in Appium, wherein the list does not have any unique identifier

As you can see in the attached image, we have an order receipt consisting of a list of items inside recycler view and the receipt can contain any number of items but we don’t have any unique identifier to distinguish the items in the list, in the attached image you can see class, resource-id is same for all the items in the receipt. So when we scroll the list, duplicate items are fetched again, as we don’t have any unique identifier to check if that particular item is fetched already from DOM or not.

So how can we check if that particular item is fetched already from DOM or not when we scroll the list.

REQUIREMENT:- We want to fetch the items from the receipt just once(no same receipt data should be fetched twice)

So how can we achieve the same using Appium?

No way. You need to write your own logic by checking names, price and compare.
Other way your test data should have unique names and check if it added.

1 Like

I would raise a testability defect ticket against your dev team and have them add ids. I do this with our web apps, and I can see myself doing the same if I hit it in our mobile app. It’s one extra line of code to write in some cases, they just need to do it, it will speed up your job, which will speed up their job. Very easy decision.