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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -