title: Selenium PageObject pattern: get objects list
body: <p>I have an application page that provides some sort of search and it returns the list of search result items to the user.
  So initally my test logs on to the application, and start search on the home page like this:</p>
  
  <pre><code>HomePage homePage = loginPage.login();     
  homePage.searchFor(items);  
  </code></pre>
  
  <p>What would be the best practiced way to test for search result contains the expected list items from the design side?</p>
  
  <ol>
  <li><p>I could add method returning result items to the Page objects and then I can do anything I want with them on the test class.</p>
  
  <pre><code>public void someTest(List&lt;Items&gt; expectedResultItems) {
      ...
      HomePage homePage = loginPage.login();     
      homePage.searchFor(items);  
      List&lt;Item&gt; resultItems = homePage.getItems();
      Util.compareItems(resultItems, expectedResultItems);
  }
  </code></pre></li>
  <li><p>I can add comparison method to the page object itself.</p>
  
  <pre><code>public void someTest(List&lt;Items&gt; expectedResultItems) {   
  
      ...
      HomePage homePage = loginPage.login();     
      homePage.searchFor(items);  
      homePage.compareItems(List&lt;Item expectedItems);
  }
  </code></pre></li>
  </ol>