nellygrl
nellygrl

Reputation: 657

XPath Expression to Get Value In Title Attribute

I am trying to write an XPath expression that returns the value of the title attribute of a link in the list item below:

<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>

So I'm looking for an XPath Expression that would return "796,433 Followers".

If anyone could help me out, it would be greatly appreciated! Thanks so much!

Upvotes: 2

Views: 8673

Answers (1)

alecxe
alecxe

Reputation: 473863

Check for the class inside li and get the @title of the a tag inside:

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

Upvotes: 4

Related Questions