Locating Web Elements by index matching

0 votes

Probably this is not the best way of locating elements, but sometimes it’s needed to use these kind of locator strategy. A reason might be the lack of element identifiers.

Select second element E:nth-child(2) //E[2]
First <E> child E:first-of-type //E[1]
Last <E> child E:last-of-type //E[last()]


Examine your knowledge and play the ‘locator game‘.

Please follow and like us:
Locating Web Elements by walking up the DOM
Locating Web Elements by label matching