Würgspaß Würgspaß - 8 days ago 5
AngularJS Question

Xpath axis not working as expected

Given this snippet:

<tr class="ng-scope" ng-repeat="config in list.elements">
<td class="ng-binding">6grxe</td>
<td class="ng-binding">ComplexTest</td>
<td class="ng-binding">2016-11-25 10:35:03</td>
</tr>
<tr class="ng-scope" ng-repeat="config in list.elements">
<td class="ng-binding">l7yc</td>
<td class="ng-binding">SimpleTest</td>
<td class="ng-binding">2016-11-25 10:35:15</td><!--how to locate this ?-->
</tr>


I tried to locate the marked element on firefox console using xpath like this:

$x("//following-sibling::td[text()='SimpleTest']")


However, the returned element is

<td class="ng-binding">SimpleTest</td>


Whats wrong with my xpath?

Answer

I think you want the path //td[. = 'SimpleTest']/following-sibling::td[1] to select the td element immediately following the td with contents SimpleTest.

Comments