user2598997
user2598997

Reputation: 297

Extract URL using xpath

What xpath should i use to extract the "URL" and title="TEXT" from this html code:

<div class="VersionAnglaise"> <a href="URL" title="Version Anglaise"
 class="LienVersionAnglaise"><strong>Version anglaise</strong></a> </div> 

Thanks in advance.

Upvotes: 2

Views: 14534

Answers (1)

har07
har07

Reputation: 89285

To get title attribute :

//div[@class='VersionAnglaise']/a/@title

To get href attribute :

//div[@class='VersionAnglaise']/a/@href

You can combine both using XPath union (|) :

//div[@class='VersionAnglaise']/a/@title | //div[@class='VersionAnglaise']/a/@href

Upvotes: 6

Related Questions