title: Extract link from XPath using Selenium Webdriver and Python?
body: <p>I'm rather new to Seleniun WebDriver and Python and my question might be kind of basic. </p>
  
  <p>So, I have the following HTML code:</p>
  
  <pre><code>&lt;a class="wp-first-item" href="admin.php?page=account"&gt;Account&lt;/a&gt;
  </code></pre>
  
  <p>And <em>I am trying to extract the href out of it</em>, be means of XPath, knowing that its XPath is <code>".//*[@id='toplevel_page_menu']/ul/li[2]/a"</code>.</p>
  
  <p>How do I do that? </p>
  
  <pre><code>driver.find_element_by_xpath(".//*[@id='toplevel_page_menu']/ul/li[2]/a").link
  </code></pre>
  
  <p>or</p>
  
  <pre><code>driver.find_element_by_xpath(".//*[@id='toplevel_page_menu']/ul/li[2]/a").href
  </code></pre>
  
  <p>Do not seem to work, resulting in:</p>
  
  <pre><code>AttributeError: 'WebElement' object has no attribute 'link'
  </code></pre>
  
  <p>I'm expecting the result to be like <code>"admin.php?page=account"</code>.</p>