title: Get text from div using Selenium
body: <p>I'm using Selenium and Python to extract info from a page </p>
  
  <p>Here is the div I want to extract from: </p>
  
  <pre><code>&lt;div class="_2v66"&gt;5&lt;/div&gt;
  </code></pre>
  
  <p>I want to extract the value "5" </p>
  
  <p>Here is the Python I have written:</p>
  
  <pre><code>element = browser.find_elements_by_class_name('_2v66').getText
  
  print('Views:')
  print(element)
  </code></pre>
  
  <p>When I run this script, I get the following message: </p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;string&gt;", line 95, in &lt;module&gt;
  AttributeError: 'list' object has no attribute 'getText'
  [Finished in 15.478s]
  </code></pre>
  
  <p>Solution: </p>
  
  <p>Although I originally thought the div class was unique, after a closer inspection of the page I realized that it is not a unique div and therefore the solution was as follows: </p>
  
  <pre><code>browser.get(('https://www.facebook.com/example_page_1/insights/?section=navVideos'))
  
  browser.implicitly_wait(60)
  
  # find_elements_by_class_name - Returns the div in which the metrics are found
  elements = browser.find_elements_by_class_name('_2v66')
  
  for e in elements:
      print(e.text)
  </code></pre>
  
  <p>The <code>browser.implicitly_wait</code> was crucial to allow the page to load. The errors I was receiving with regards to the object no existing were because of that. </p>