I don\'t know why following query doesn\'t work:
//a/@href[@class=\'specified_string\']
An attribute cannot have attributes. Only elements can have attributes.
The original XPath expression:
//a/@href[@class='specified_string']
selects any href
attribute of any a
element, such that the href
attribute has an attribute class
whose value is 'specified_string'
.
What you want is:
//a[@class='specified_string']/@href
that is: the href
attribute of any a
element that has class
atribute with value 'specified_string'
.