Using XPath to select the href attribute of the following-sibling
I assume you're using Google Chrome console because of that $x()
function. Your xpath which selects @href
attribute actually worked, as I tested in my Chrome, only the result is not displayed in the console like when you selected an element -for a reason that I'm not quite sure at the moment- :
>var result = $x("//th[contains(text(), 'Web Address')]/following-sibling::td/a/@href")undefined>result[0].value"http://www.co.sullivan.ny.us"
see that using the exact same expression, variable result
contains the expected url value. If your intention is simply to display single href
value in the console without further processing, this will do :
>$x("//th[contains(text(), 'Web Address')]/following-sibling::td/a/@href")[0].value"http://www.co.sullivan.ny.us"