我有以下html:
<span class="stArrow"><span class="stButton_gradient stHBubble" style="display: inline-block;"><span class="stBubble_hcount">4</span></span></span>
为了使用htmlagilitypack获取文本,我使用了xpath:
//span[@class='stArrow']//span[@class='stButton_gradient']//span[@class='stBubble_hcount']
但是没有拿到任何价值。经过严格的测试,我发现xpath可能有问题。谁能指出这里的错误?
答案 0 :(得分:0)
应该是
//span[@class='stArrow']//span[@class='stBubble_hcount']
答案 1 :(得分:0)
您可以使用:
//span[@class='stArrow']/span[contains(@class, 'stButton_gradient')]/span[@class='stBubble_hcount']/text()