How to locate element in Android

Hi All,

I would like to click on the 4683 PTS action bar and for that I have made xpath as “//$Tab[contains(@index,‘2’)]//android.widget.ImageView[contains(@index,‘0’)]”. But this one is not working. Also directly building the xpath as “//android.widget.TextView[@text=‘4683 PTS’]” would not work in future since the points gets changed for different users.

Can anyone suggest on how to build up the xpath?

Please find attached the screenshot.

1 Like

Hi Arijit, try using this:


so if in future the points get changed still it may have ‘PTS’ there in TEXTVIEW.:slight_smile:

  1. Try to click by coordinates.
  2. Try this "//$Tab[contains(@index=‘2’)]
1 Like