XPath表达式在标题属性中获取值

时间:2014-09-04 01:49:19

标签: xpath

我正在尝试编写一个XPath表达式,该表达式返回下面列表项中链接的title属性的值:

<li class="ProfileNav-item ProfileNav-item--followers"><a href="/profileurl/followers" data-nav="followers" title="796,433 Followers" class="ProfileNav-stat ProfileNav-stat--link u-borderUserColor u-textCenter js-tooltip js-openSignupDialog js-nonNavigable u-textUserColor" target=""><span class="ProfileNav-label">Followers</span> <span data-is-compact="true" class="ProfileNav-value">796K</span></a></li>

所以我正在寻找一个可以返回&#34; 796,433粉丝&#34;。

的XPath表达式。

如果有人能帮助我,我们将不胜感激!非常感谢!

1 个答案:

答案 0 :(得分:2)

检查li内的课程,并获取@title标记内的a

//li[contains(@class, "ProfileNav-item")]/a/@title