I am analyzing a web page that includes this structure:
<tr> <td>Label 1</td> <td>Label 2</td> <td>Label 3</td> <td>Something else</td> <\tr> <tr> <td>Item 1</td> <td>Item 2</td> <td>Item 3</td> <\tr>
What I need to do is select an element based on its label, so I think that if the label is in the third tag on this line, I can grab the third tag on the next line to find the element. I cannot find a way to use the position () function this way, and maybe xpath (1.0) will not be able to handle this type of filtering.
My best attempt: //td[ancestor::tr[1]/preceding-sibling::tr[1]/td[position()]] . I was hoping the position () function would capture the <td> position at the beginning of the xpath, since the rest of the xpath is a filter for this node.
Am I trying to make it even possible?
html xpath selenium-webdriver
eldon111
source share