lib/WebDriverExpectedCondition.php
public static function visibilityOfAnyElementLocated(WebDriverBy $by)
    {
        return new static(
            function (WebDriver $driver) use ($by) {
                $elements = $driver->findElements($by);
                $visibleElements = [];

                foreach ($elements as $element) {
                    try {
                        if ($element->isDisplayed()) {
                            $visibleElements[] = $element;
                        }
                    } catch (StaleElementReferenceException $e) {
                    }
                }

                return count($visibleElements) > 0 ? $visibleElements : null;
            }
        );
    }
public static function visibilityOfAnyElementLocated(WebDriverBy $by)
    {
        return new static(
            function (WebDriver $driver) use ($by) {
                $elements = $driver->findElements($by);
                $visibleElements = [];

                foreach ($elements as $element) {
                    try {
                        if ($element->isDisplayed()) {
                            $visibleElements[] = $element;
                        }
                    } catch (StaleElementReferenceException $e) {
                    }
                }

                return count($visibleElements) > 0 ? $visibleElements : null;
            }
        );
    }
public static function visibilityOfAnyElementLocated ( WebDriverBy $ by ) { return new static ( function ( WebDriver $ driver ) use ( $ by ) { $ elements = $ driver -> findElements ( $ by ) ; $ visibleElements = [ ] ; foreach ( $ elements as $ element ) { try { if ( $ element -> isDisplayed ( ) ) { $ visibleElements [ ] = $ element ; } } catch ( StaleElementReferenceException $ e ) { } } return count ( $ visibleElements ) > 0 ? $ visibleElements : null ; } ) ; }
An expectation for checking than at least one element in an array of elements is present on the
DOM of a page and visible.
Visibility means that the element is not only displayed but also has a height and width that is greater than 0.

@param WebDriverBy $by The located used to find the element.
@return static Condition returns the array of WebDriverElement that are located and visible.
An expectation for checking than at least one element in an array of elements is present on the DOM of a page and visible . Visibility means that the element is not only displayed but also has a height and width that is greater than 0 .