title: Use Python Selenium to get span text
body: <p>This should be easy, but I can't get it to work. I'm running a little demo using the Google homepage as a test. </p>
  
  <p>Here's my script:</p>
  
  <pre><code>from selenium import webdriver
  from selenium.common.exceptions import NoSuchElementException
  from selenium.webdriver.common.keys import Keys
  import time
  
  browser = webdriver.Chrome()
  browser.get("http://www.google.com") # Load page
  
  time.sleep(0.2)
  
  #top nav elements
  elems = browser.find_elements_by_xpath("//span[contains(@class, 'gbts')]") 
  
  for e in elems:
      print e.get_attribute('text')
  
  browser.close()
  </code></pre>
  
  <p>It returns:</p>
  
  <pre><code>None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  None
  </code></pre>
  
  <p>So I think it's grabbing the right elements, but perhaps not the right attribute? Not sure. I also tried to print e.text() but that spit out:</p>
  
  <pre><code>Traceback (most recent call last):
    File "sample.py", line 14, in &lt;module&gt;
      print e.text()
  TypeError: 'unicode' object is not callable
  </code></pre>
  
  <p>Any thoughts?</p>
  
  <p>*<em>Edit - Possible Solution? *</em></p>
  
  <pre><code>e.get_attribute('innerHTML') seems to work.
  </code></pre>