Reputation: 45
Searching for those node "col_functions" whose table row values is "John Wayne" from the table @class="table_list".
("col_functions", "col_firstname" and "col_lastname are sibling nodes and childs from the table)
<table class="table_list">
<tbody>
<tr>
<td class="col_firstname">John</td>
<td class="col_lastname">Lennon</td>
<td class="col_functions"></td>
</tr>
<tr>
<td class="col_firstname">John</td>
<td class="col_lastname">Wayne</td>
<td class="col_functions"></td> <=== looking for this node!!
</tr>
<tr>
<td class="col_firstname">Wayne</td>
<td class="col_lastname">John</td>
<td class="col_functions"></td>
</tr>
</tbody>
<table>
Upvotes: 1
Views: 949
Reputation: 1515
Using siblings it will be like that:
//table[@class='table_list']//td[@class='col_firstname'][text()='John']/following-sibling::td[@class='col_lastname'][text=()'Wayne']/following-sibling::td[@class='col_functions']
Upvotes: 1
Reputation: 474221
One option would be to check for class names all over the place:
//table[@class="table_list"]//tr[td[@class="col_firstname"] = "John" and td[@class="col_lastname"] = "Wayne"]/td[@class="col_functions"]/text()
Here we are basically checking all rows inside the table
for cells with first name John
and last name Wayne
, getting the cell with col_functions
as an output.
Upvotes: 1