2

私はテストを書くためにSeleniumとJavaを使用しています。タグが最後のものであるかどうかをチェックする方法

<tbody> 
<tr> 
    <th>Copy</th> 
    <th>Subfield</th> 
    <th>Subfield Border</th> 
    <th>Field</th> 
    <th>Field Border</th> 
</tr> 
<tr id="333877"> 
    <td> 
     <input type="checkbox" checked="" class="copySubfieldBorderCheck"/> 
    </td> 
    <td>a</td> 
    <td class="s">No</td> 
    <td>c</td> 
    <td>Yes</td> 
</tr> 
<tr> 
    <th>as</th> 
    <th>er</th> 
    <th>df</th> 
    <th>xc</th> 
    <th>xc</th> 
</tr> 
<tr id="333877"> 
    <td> 
     <input type="checkbox" checked="" class="copySubfieldBorderCheck"/> 
    </td> 
    <td>rt</td> 
    <td class="noBorderBoldRed">Yes</td> 
    <td>ff</td> 
    <td>sdf</td> 
</tr> 

は、私がテキストですNoとALOSそれがLAST tdタグのテキストは、私が何かを探していますYes

あるtdタグを持っているtrを取得したい:私は以下のDOMを持っていますこのように:

//tr[./td[text()='No'] and ./td[text()='Yes' and isLast()]]

答えて

1

簡単な方法は、concatの3番目と最後のセルになり、次にNoYesのテキストをフィルタリングします。

//tr[concat(td[3], td[last()])='NoYes'] 
関連する問題