title: How to compare to List<WebElement> in webdriver?
body: <p>I am trying to automate Dual list Box testing. I want to compare the selected values(left side) vs moved values (into right side list). Here is the code. </p>
  
  <pre><code>Select allFromListData = new Select(listData);
      // values selection
      allFromListData.selectByIndex(0);
      allFromListData.selectByVisibleText("Helena");
      List&lt;WebElement&gt; selectedList=allFromListData.getAllSelectedOptions();
      //clicking on add button
  
      for(int i=0;i&lt;selectedList.size();i++)
          System.out.println(selectedList.get(i).getText());
      WebElement addButton = driver.findElement(By.xpath("//*[@id='pickList']/div/div[2]/button[1]"));
      addButton.click();
  
      //Verification of selected content... 
      WebElement toListData=driver.findElement(By.xpath("//*[@id='pickList']/div/div[3]/select"));
      Select allToListData = new Select(toListData);
      List&lt;WebElement&gt; movedData=allToListData.getOptions();
  </code></pre>
  
  <p>Question is how to compare the data between <code>List&lt;WebElement&gt; selectedList=allFromListData.getAllSelectedOptions();</code> and <code>List&lt;WebElement&gt; movedData=allToListData.getOptions();</code></p>