I've got a website with a structure that looks like
<table id='container'>
<tbody>
<tr>
<td data-th='Name'>child elements and data</td>
<td data-th='Age'>
child elements and data </td>
<td data-th='Sex'>
child elements and data </td>
<td data-th='Hobby'>
child elements and data </td>
</tr>
<tr id='detail-111'>
<bunch of irrelevant child elements.....>
</tr>
<tr>......</tr>
<tr>
<td data-th='Name'>child elements and data2</td>
<td data-th='Age'> child elements and data2 </td>
<td data-th='Sex'> child elements and data2 </td>
<td data-th='Hobby'> child elements and data2 </td>
</tr>
<tr id='detail-222'>
<bunch of irrelevant child elements.....>
</tr>
<tr>......</tr>
<tr>
<td data-th='Name'>child elements and data n</td>
<td data-th='Age'> child elements and data n </td>
<td data-th='Sex'> child elements and data n </td>
<td data-th='Hobby'> child elements and data n</td>
</tr>
<tr id='detail-nnn'>
<bunch of irrelevant child elements.....>
</tr>
<tr>......</tr>
</tbody>
</table>
I wrote this xpath but not getting the desired result:
objTBody.FindElementsByXpath("//tr/td[@data-th='Name']")
It returns the td element in row 1, but what i really want to get is the parent row, not the name td. The row just doesnt have attributes of its own so I am forced to identify it by attributes of its children.
Another question , how do i return a collection of all direct children. If I have a parent dive with 10 children div elements, each having their own div child elements, and I want a collection of the 10 children of the parents, how do i do that? When i try, the grandchildren get returned. Children in IE doesnt do that.
Thank you