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.

CSS XPath
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:
Follow by Email
Facebook
Google+
http://www.seleniuminaction.com/locating-web-elements-by-index-matching/
Twitter
LinkedIn
Locating Web Elements by walking up the DOM
Locating Web Elements by label matching

Leave a Reply

Your email address will not be published. Required fields are marked *