Answered

Which command to use for selecting List view Row by index or value in Android app automation?

As our app has many List views in app so those getting generated by data we gets from server they are not fixed data it is dynamic data so List view gets generated every time differently based on data and As in app we use same layout for all rows so it is not possible to use  ResourceID/X-path we get from Appium setups . It will be good if any one can help with this as well.  

0
2 comments
Avatar
Jonathan Hotz

Hi Dhrupa,
could you please provide suggested XPath examples and screenshots if my advice below doesn't fit your needs?

 

If I understand your have next problem:

Let's define row that you need has label "My Label" and it's 5th in the moment you use inspector to get XPath.
Inspector have suggested XPath like //TableElement/RowElementCell[5]. Based on data this element can be 2nd or 12th - all time dynamic, so it doesn't work for you to use index 5.

For such case you can use same solution that you use for WEB XPath construction (it's described in Subject 7 tutorials) - just write your own XPath similar to next one: //TableElement/RowElementCell[./Label[text()='My Label']].

 

Sometimes it happens that element is not visible on start, because there are many other rows in the table, so your row has not been even created yet for visualization. In such case you need to scroll to your element firstly. For such case you can use element with XPath from the example above in command Mobile_Scroll that will scroll to your element (or until it reaches limit of scroll tries).

0
Comment actions Permalink
Avatar
Dhrupa Patel

Ok I will try to do this as you explained. Thank you 

0
Comment actions Permalink

Please sign in to leave a comment.