我正在尝试编写一个XPath来从下面的标记中提取值55.3469。但我不知道从哪里开始。
<tr class="uccRes">
<td width="47%" align="right" class="leftCol">100.00 <span class="uccResCde">ALL</span><!-- This is test data. -->
</td>
<td width="6%" valign="middle" align="center">=</td>
<td width="47%" align="left" class="rightCol">55.3469 <span class="uccResCde">AFN</span><!-- This is test data. -->
</td>
</tr>
答案 0 :(得分:0)
首先使用span
文字和AFN
找到class="uccResCde"
,然后获取preceding-sibling
:
//span[@class='uccResCde' and text()='AFN']/preceding-sibling::text()