code: public static ExpectedCondition<List<WebElement>> visibilityOfNestedElementsLocatedBy(
      final WebElement element, final By childLocator) {
      return new ExpectedCondition<List<WebElement>>() {
  
        @Override
        public List<WebElement> apply(WebDriver webDriver) {
          List<WebElement> allChildren = element.findElements(childLocator);
          // The original code only checked the visibility of the first element.
          if (!allChildren.isEmpty() && allChildren.get(0).isDisplayed()) {
            return allChildren;
          }
  
          return null;
        }
  
        @Override
        public String toString() {
          return String.format("visibility of element located by %s -> %s", element, childLocator);
        }
      };
    }
docs: An expectation for checking child WebElement as a part of parent element to be visible
  
  @param element     used as 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 visible subelement