I assume that you are using the Google Chrome console because of this $x() function. Your xpath, which selects the @href attribute, actually works , as I tested in my Chrome, only the result is not displayed in the console, as when choosing an element - for the reason that I'm not quite 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 same expression, the result variable contains the expected url value. If your intention is to simply display a 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"
source share