code: public static ExpectedCondition<List<WebElement>> presenceOfNbElementsLocatedBy(final By locator, final int nb) {
          return new ExpectedCondition<List<WebElement>>() {
              @Override
              public List<WebElement> apply(WebDriver driver) {
                  final List<WebElement> elements = driver.findElements(locator);
                  return elements.size() == nb ? elements : null;
              }
          };
      }
docs: An expectation for checking that nb elements that match the locator are present on the web page.
  
  @param locator
  Locator of element
  @param nb
  Expected number of elements
  @return the list of WebElements once they are located