src/LinusShops/Contexts/Web.php
public function waitForAtLeastOneVisibleElementOfType($selectorString)
    {
        $this->waitFor(function ($context) use ($selectorString) {
            /** @var Web $context */
            $page = $context->getSession()->getPage();
            /** @var NodeElement[] $nodes */
            $nodes = $page->findAll('css', $selectorString);
            /** @var NodeElement $node */
            foreach ($nodes as $node) {
                if ($node->isVisible()) {
                    return true;
                }
            }
            return false;
        });
    }
public function waitForAtLeastOneVisibleElementOfType($selectorString)
    {
        $this->waitFor(function ($context) use ($selectorString) {
            /** @var Web $context */
            $page = $context->getSession()->getPage();
            /** @var NodeElement[] $nodes */
            $nodes = $page->findAll('css', $selectorString);
            /** @var NodeElement $node */
            foreach ($nodes as $node) {
                if ($node->isVisible()) {
                    return true;
                }
            }
            return false;
        });
    }
public function waitForAtLeastOneVisibleElementOfType ( $ selectorString ) { $ this -> waitFor ( function ( $ context ) use ( $ selectorString ) { /** @var Web $context */ $ page = $ context -> getSession ( ) -> getPage ( ) ; /** @var NodeElement[] $nodes */ $ nodes = $ page -> findAll ( 'css' , $ selectorString ) ; /** @var NodeElement $node */ foreach ( $ nodes as $ node ) { if ( $ node -> isVisible ( ) ) { return true ; } } return false ; } ) ; }
Passes when at least one element with the given selector is visible on the page.

Use when there are multiple potential matches, but not all of them may
be visible on the page.

@Given /^at least one selector matching "([^"]*)" is visible$/

@param $selectorString
@throws \Exception
Passes when at least one element with the given selector is visible on the page .