I have this html page:
<tr class="facts_label"></tr>
<tr class="facts_label"></tr>
<tr class="other_label"></tr>
<tr class="facts_label"></tr>
<tr class="facts_label"></tr>
<tr class="other_label"></tr>
<tr class="other_label"></tr>
<tr class="facts_label"></tr>
<tr class="facts_label"></tr>
<tr class="other_label"></tr> # Select this
<tr class="other_label"></tr> # Select this
<tr class="facts_label"></tr>
<tr class="other_label"></tr>
<tr class="other_label"></tr>
I want to select tr elements with class "other_label" that are between the last two tr elements with class "Facts_label"
I tried:
'//tr[@class="other_label" and (preceding-sibling::tr[@class="facts_label"][last()-1]) and (following-sibling::tr[@class="facts_label"][last()])]'
But this is what I got
<tr class="facts_label"></tr>
<tr class="facts_label"></tr>
<tr class="other_label"></tr> # Got this
<tr class="facts_label"></tr>
<tr class="facts_label"></tr>
<tr class="other_label"></tr> # Got this
<tr class="other_label"></tr> # Got this
<tr class="facts_label"></tr>
<tr class="facts_label"></tr>
<tr class="other_label"></tr> # Got this
<tr class="other_label"></tr> # Got this
<tr class="facts_label"></tr>
<tr class="other_label"></tr>
<tr class="other_label"></tr>
source
share