public static ExpectedCondition<List<WebElement>> presenceOfNestedElementsLocatedBy(
    final By parent,
    final By childLocator) {
    return new ExpectedCondition<List<WebElement>>() {

      @Override
      public List<WebElement> apply(WebDriver driver) {
        List<WebElement> allChildren = driver.findElement(parent).findElements(childLocator);

        return allChildren.isEmpty() ? null : allChildren;
      }

      @Override
      public String toString() {
        return String.format("visibility of element located by %s -> %s", parent, childLocator);
      }
    };
  }
public static ExpectedCondition < List < WebElement > > presenceOfNestedElementsLocatedBy ( final By parent , final By childLocator ) { return new ExpectedCondition < List < WebElement > > ( ) { @ Override public List < WebElement > apply ( WebDriver driver ) { List < WebElement > allChildren = driver . findElement ( parent ) . findElements ( childLocator ) ; return allChildren . isEmpty ( ) ? null : allChildren ; } @ Override public String toString ( ) { return String . format ( "visibility of element located by %s -> %s" , parent , childLocator ) ; } } ; }
An expectation for checking child WebElement as a part of parent element to present

@param parent     used to check parent element. For example table with locator
By.xpath("//table")
@param childLocator used to find child element. For example td By.xpath("./tr/td")
@return subelement