title: Iterating through elements get repeating result on Selenium on Python
body: <p>I'm having an issue that I'm struggling to understand. I have a HTML with a ul list with a bunch of li items, and within those li items they have elements that I would like to scrape using Selenium on Python. The website makeup is as follows</p>
  
  <pre><code>&lt;ul id="results"&gt;
      &lt;li&gt;
          &lt;div class="name"&gt;John&lt;/div&gt;
          &lt;div class="age"&gt;23&lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;
          &lt;div class="name"&gt;Bob&lt;/div&gt;
          &lt;div class="age"&gt;39&lt;/div&gt;
      &lt;/li&gt;
      ..... #more li
  &lt;/ul&gt;
  </code></pre>
  
  <p>So this seems like a pretty simple problem where we just save the li elements as a variable, and iterate through each list to save the information. The problem is that no matter what I do, my results always gives back the first list item over and over again. It will loop through the correct number of elements, but always refer back to the first one. So if I do the following</p>
  
  <pre><code>results = driver.find_elements_by_xpath("""//*[@id="results"]/li""")
  for result in results:
      name = result.find_element_by_xpath("""//*[@class="name"]""").text
      print(name)
  </code></pre>
  
  <p>Now if there is 10 li elements in this particular case, the name "John" will just print out 10 times rather than updating based on the iterated list.</p>