#7 Find Elements Using Index and XPath last and position functions

Опубликовано: 29 Сентябрь 2024
на канале: QA Box Let's Test
3,684
36

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]