title: Selenium - Iterating through groups of elements - Python
body: <p>I'm trying to iterate over a number of elements returned by matching class names, which I have stored in an array <code>users</code>. The <code>print(len(users))</code> outputs as 12, which is accurately correct as to how many returned there should be. This is my code:</p>
  
  <pre><code>def follow():
      time.sleep(2)
      # iterate here
      users = []
      users = browser.find_elements_by_class_name('wo9IH')
      print(len(users))
      for user in users:
          user_button = browser.find_element_by_css_selector('li.wo9IH div.Pkbci').click()
          #user_button = browser.find_element_by_xpath('//div[@class="Pkbci"]/button').click()
  </code></pre>
  
  <p>However currently, only index [0] is being <code>.click()</code>'d and the program is terminating after this first click. What would be the problem as to why the index being iterated isn't incrementing?</p>
  
  <p><strong>resource:</strong> <a href="http://image.ibb.co/jdBU7f/unknown.png" rel="nofollow noreferrer">image</a> - red shows what's being iterated through and blue is each button being .click()'d</p>