I am trying to write an XPath to pull the value 55.3469 from the tag below., but I am not sure where to start.

<tr class="uccRes">
<td width="47%" align="right" class="leftCol">100.00&nbsp;<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&nbsp;<span class="uccResCde">AFN</span><!-- This is test data. -->
</td>
</tr>
有帮助吗?

解决方案

First find the span with AFN text and class="uccResCde", then get the preceding-sibling:

//span[@class='uccResCde' and text()='AFN']/preceding-sibling::text()
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top