title: How to store values from a list to arraylist in selenium
body: <p>I am trying to store the values from a list to a global array for later use/verify in other pages.</p>
  
  <p>My element looks like below:</p>
  
  <p>Tried array list which gives only the 1st line, but I have multiple items in the list.</p>
  
  <pre><code>&lt;div class="col-lg-7"&gt;
      &lt;div class="clearfix" style="padding-bottom:5px;"&gt;
          &lt;i class="fa fa-user"&gt;&lt;/i&gt;&lt;span style="margin-left:2%"&gt;Veena Pujari (Attorney)&lt;/span&gt;
      &lt;/div&gt;
      &lt;div class="clearfix" style="padding-bottom:5px;"&gt;
          &lt;i class="fa fa-user"&gt;&lt;/i&gt;&lt;span style="margin-left:2%"&gt;Ranjit Nayak (Accredited Representative)&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I am trying to pull the values ex:</p>
  
  <pre><code>List&lt;WebElement&gt; PMPageCMList = driver.findElements(By.xpath("//*[@id='collapseCM']/div[2]/div[2]"));
              int totalcms = PMPageCMList.size();
              for(int i=1;i&lt;=totalcms;i++){
                  CaseManagersreceivingreminders.add(driver.findElement(By.xpath("//*[@id='collapseCM']/div[2]/div[2]/div"+"["+i+"]"+"/span")).getText());
                  System.out.println(CaseManagersreceivingreminders);
  </code></pre>