title: InvalidSelectorException: Message: invalid selector: The result of the xpath expression is [object Attr]. It should be an element using XPath Selenium
body: <p><a href="https://i.stack.imgur.com/Oyfnx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Oyfnx.png" alt="Here is the html" /></a>
  Hi I want to locate the href element connected to a student named &quot;John Doe&quot; based on the <code>following-sibling</code> input value of 'ST'. This the code im using to select the element:</p>
  <pre><code>driver.find_element_by_xpath('//a[following-sibling::input[@value=&quot;ST&quot;]]/@href').click()
  </code></pre>
  <p>It's locating the correct element but im getting this error:</p>
  <pre><code>selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: The result of the xpath expression &quot;//a[following-sibling::input[@value=&quot;ST&quot;]]/@href&quot; is: [object Attr]. It should be an element.
  </code></pre>
  <p>How can I fix this?</p>