title: Selenium: Find adjacent elements
body: <p>First off, I hope this question isn't too general in its scope – if so I apologize.</p>
  
  <p>I'm building a web scraper using <code>Selenium</code> for <code>Python 2.7</code>. Previously, I have used "static" <code>XPaths</code> to direct it toward certain elements. I want to implement a solution that can finds elements contextually (relative to other elements).</p>
  
  <p>Let's say we wish to grab the text from the sibling element following the "<em>Issuer:</em>" label on this page: <a href="http://etfdb.com/etf/ROBO/" rel="nofollow">http://etfdb.com/etf/ROBO/</a>. In this case the adjacent text is "<em>Exchange Traded Concepts</em>".</p>
  
  <p>From what I've gathered, it could be possible to use a number of techniques including relative <code>XPath</code>, <code>CSS</code> or <code>DOM</code>(?).</p>
  
  <p>What would be an advisable way to go about this? Please demonstrate with code if possible.</p>
  
  <hr>
  
  <p><strong>Current "Static" XPath</strong>, where have identified the XPath with <a href="https://github.com/pierretholence/firepath" rel="nofollow">FirePath</a> for Firefox:</p>
  
  <pre><code>try:
      xpath_issuer = ".//*[@id='overview']/div/div[2]/div/div[1]/ul[1]/li[1]/span[2]/a"
      find_issuer = driver.find_element_by_xpath(xpath_issuer)
      issuer = re.search(r"(.+)", find_issuer.text).group().encode("utf-8")
      print "Issuer: %s" % issuer
      break
  except NoSuchElementException:
      pass
  </code></pre>