سؤال

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