USING INDEX, LAST AND POSITION METHODS
Index - If an Xpath returns multiple elements, the syntax element[index] can be used. Note that XPath uses one-based indexing, therefore the first element has index 1, the second has index 2 etc.
Last Function Return last element in tree node structure. Example - //button[last()], //button[last() -1]
Position Function Return element in tree node structure at the specified Position. Example - //button[position()=1], //button[position()=last() -1]