86. position() function in XPath Expressions (Selenium Java 2026)

Publié le: 16 mai 2026
sur la chaîne: QAFox
59
1

position() XPath Function

position() is an optional XPath function
It returns the position of a node within a node-set (starting from 1)

Practical Demonstration

//p[1] selects the first p element
//p[position()=1] same as above
//p[2] selects the second p element
//p[position()=2] same as above
(//input)[1] selects the first input element
(//input)[position()=1] same as above

Key Point:
Using [n] is shorthand for [position()=n] in XPath.


Sur cette page du site, vous pouvez voir la vidéo en ligne 86. position() function in XPath Expressions (Selenium Java 2026) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur QAFox 16 mai 2026, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 59 fois et il a aimé 1 téléspectateurs. Bon visionnage!