indexing - How to get element's index by xpath? -


i've next structure :

<div id='list'>    <div class='column'>aaa</div>    <div class='column'>bbb</div>    ...    <div class='column'>jjj</div> </div> 

i wonder if there ways use xpath, , write query can index of requested element within "list" element.

i mean i'll ask location of class='column' text value aaa , i'll 0 or 1...

thanks

you count div elements preceding element you're looking for:

count(div[@id = 'list']/div[@id = 'myid']/preceding-sibling::div) 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -