Jump to content

XPATH that will allow me to distinguish between the 3 buttons even though the buttons have the same values.


fabio73

Recommended Posts

Some quick context to what I'm doing. I'm utilizing a test automation tool called SOASTA. What this software allows me to do is record performed actions on a mobile device and then play back those same actions at anytime. When recording actions, SOASTA will assign the action performed a random locator value. This value can be modified to equal a specific XPATH value.

 

On the mobile application I'm recording action on, I have 3 files stored called TEST SIGN.doc, TEST SIGN.docx, and TEST SIGN.pdf, separated by the node <RelativeLayout> in the XML code shown below. Each of these files have a button on them that when tapped, opens a window to perform certain actions. In the XML hierachy, these three buttons are all assigned the same value of, <DontPressWithParentImageView touchTestId="img_item_action"/>.

 

My question is, is there an XPATH that will allow me to distinguish between the 3 buttons even though the buttons have the same values?

 

THANK YOU IN ADVANCE!!

 

<ListView touchTestId="16908298"> <RelativeLayout> <ImageView touchTestId="img_icon"/> <TextView text="TEST SIGN.doc" touchTestId="txt_title"/> <TextView text="21.5 KB, modified Jan 20, 2014 03:36 PM" touchTestId="txt_info"/> <CheckBox text="" touchTestId="checkbox"/> <View touchTestId="divider"/> <DontPressWithParentImageView touchTestId="img_item_action"/> </RelativeLayout> <RelativeLayout> <ImageView touchTestId="img_icon"/> <TextView text="TEST SIGN.docx" touchTestId="txt_title"/> <TextView text="12.6 KB, modified Jan 20, 2014 03:36 PM" touchTestId="txt_info"/> <CheckBox text="" touchTestId="checkbox"/> <View touchTestId="divider"/> <DontPressWithParentImageView touchTestId="img_item_action"/> </RelativeLayout> <RelativeLayout> <ImageView touchTestId="img_icon"/> <TextView text="TEST SIGN.pdf" touchTestId="txt_title"/> <TextView text="12.7 KB, modified Jan 20, 2014 03:36 PM" touchTestId="txt_info"/> <CheckBox text="" touchTestId="checkbox"/> <View touchTestId="divider"/> <DontPressWithParentImageView touchTestId="img_item_action"/> </RelativeLayout></ListView>

Link to comment
Share on other sites

ListView/RelativeLayout[1]/DontPressWithParentImageView

Change the number RelativeLayout[N] according to where you want to point

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...