无法获得<a> with XPath despite being able to get other attributes

时间:2016-02-03 16:37:28

标签: html xml xpath xhtml

Given:

<a href="http://british-business-bank.co.uk/?p=6419" class="cta"><i class="fa fa-arrow-circle-right"></i>Senior Project Manager – Northern Powerhouse Investment Fund</a>

This XPath correcty returns this anchor.

//a[contains(text(), 'Project')]

And if I want to get its class attribute, the following XPath works:

//a[contains(text(), 'Project')]/@class

I would expect that getting attribute href would involve something similar, yet:

//a[contains(text(), 'Project')]/@href

doesn't return anything (at least not in the Console of Chrome Dev Tools). Why not?

0 个答案:

没有答案