XPath follow-sibling从中获取文本

时间:2016-03-08 19:03:14

标签: xml selenium xpath

通过XPath,我通过专门使用<td>和关键字(尝试获取位于第二个0.56(文字:following-sibling)中的文字值( . = 'Vitamin D')。

<html>
    <body>
        <td><a href="http://website.com/12345.php">Vitamin D</a></td>
        <td>0.56</td>
        <td>µg</td>
        <td>5</td>
    </body>
</html>

到目前为止,我已设法通过其链接内容识别第一个<td>中的文字:

//a[starts-with(@href, 'http://website.com/') and . = 'Vitamin D']

我尝试了这个和其他替代方案,但我没有做对:

//a[starts-with(@href, 'http://website.com/') and . = 'Vitamin D']/following-sibling::td

//a[starts-with(@href, 'http://website.com/') and . = 'Vitamin D']following-sibling::text()

0 个答案:

没有答案
相关问题