AS - Copy Unique XPath
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
The Unique XPath feature gives you the ability to automatically generate an XPath query that will uniquely identify a specific element, based on the properties of both the desired element itself, and other elements around it if necessary. The query will use the fewest possible different properties that are necessary to uniquely identify the element.
To create the query, right-click on the element in the object spy tree. There will be two options available regarding Xpath.
Example: Identifying "Details goes here" under "Expense : 2"
Copy Unique Xpath
When you click on copy unique Xpath, the identification query would be copied to the clipboard. In the above example query would be:
xpath=//*[@text='Detail goes here' and ./preceding-sibling::*[@text='Expense : 2']]
Because the desired element does not have any unique properties of its own, the query relies on the text property of one of the element's siblings in the tree in order to create the unique identification. This query can now be pasted in the element identification field in either a dynamic command or an object from the repository.
The desired element will now be uniquely identified:
Copy Unique Xpath (skip text):
When you click on copy unique Xpath (skip text), the identification query would be copied to the clipboard but this will not include text property of any of the objects . For the same example query would be:
xpath=(//*[@id='expenseListView']/*/*[@id='detailTextView'])[2]
This is recommended option when need to handel dynamic object which there text will changed.
The desired element is uniquely identified: