How to identify the android.widget.ImageView associated with the liniar layout, if class name/resource id are same for multiple records

Scenario: I have customer data in a screen resides in linear layout with 3 textview and a relative layout in it at right side with two image view and a textview.

I have only text view input to scroll till that layout upon scrolling to that linear layout, have to click on the image view present in that linear layoout.

properties for image view of all linear layout are same, index is also same for all image view of linear layout.

How can i achieve it? please suggest.

Hi @ssunagad,

make a list of all the imageview which are visible according to the linearlayout, you have to use xpath axes like following-sibling, following, preceding-sibling, preceding for this.
after making the list of imageview according to the linearlayout, you can easily access by indexing.

I hope it will help :slight_smile:

Thanks for replying, I have tried this approach and not succeeded however, using the input text view getting the x and y co-ordinates location, then adding the distance of image-view co-ordinates and clicking on however this solution depends on device screen resolution.

int x=aadharNo.getLocation().getX();
x=x + 465;
int y=aadharNo.getLocation().getY();
y=y + 9;
tap(x, y);

Thank You Again