title: Selenium - locating multiple elements with the same class name
body: <p>Hello there I am trying to locate multiple elements with the same className. The className and the body structure of the elements are the same but the texts, links and pictures are different.</p>
  
  <pre><code>  &lt;div class="dc-content-right clearfix"&gt; (parent)
    &lt;div class="dc-item clearfix"&gt;        (child nodes) 
    &lt;div class="dc-item clearfix"&gt;
    &lt;div class="dc-item clearfix"&gt;
  </code></pre>
  
  <p>Each of these child elements looks something like this: </p>
  
  <pre><code>&lt;div class="dc-item clearfix"&gt;
    &lt;div class="dc-icon"&gt;
    &lt;div class="dc-info"&gt;
      &lt;h2&gt;
        &lt;a href="http://www.avg.com/ww-en/free-antivirus-download"&gt;AVG AntiVirusFree 2015&lt;/a&gt;
      &lt;/h2&gt;
  </code></pre>
  
  <p>Each child element has <strong>different text</strong> in the H2 tag. So once it is AVG AntiVirus Free 2015, then it is Internet Security .... and so on. So what I want to do is save all elements into a list and then work with them.
  At first I save these elements  intto a list of WebElements :</p>
  
  <pre><code>List &lt;"WebElement"&gt; list = driver.findElements(By.xpath("//div[@class='dc-item clearfix']"));
  </code></pre>
  
  <p>Afterwards I want to iterate through the list and write the h2 text for each element on the screen:</p>
  
  <pre><code>for(WebElement i:superDiv)
              {
                  System.out.println(i.findElement(By.xpath("//h2/a")).getText());
              }
  </code></pre>
  
  <p>So the outcome should be a list of 3 different headings extracted from <code>divs</code>. The <strong>problem</strong>: the outcome is the list of 3 headings which are <strong>the same</strong>! </p>
  
  <pre><code>AVG AntiVirus Free 2015
  AVG AntiVirus Free 2015
  AVG AntiVirus Free 2015
  </code></pre>
  
  <p>It looks like I located the same element 3 times. Does anyone have an idea what could be the problem? Thank you</p>