dom - Address elment by number from differnet parents using xpath -
so have dom structure
<body> <div> <a></a> <a></a> </div> <div> <a></a> </div> </body>
i can access 2 first link element using xpath:
//div/a[1] //div/a[2]
and want access 3rd link using same xpath structure (to enumerate them all)
//div/a[3]
but method fails, because link elements have different parent div's way correct xpath access link elements it's number?
you can use parenthesis:
(//div/a)[3]
Comments
Post a Comment