src/LinusShops/Contexts/Web.php
public function clickFirstVisibleElementOfType($selectorString)
    {
        $page = $this->getSession()->getPage();
        /** @var NodeElement[] $nodes */
        $nodes = $page->findAll('css', $selectorString);
        foreach ($nodes as $node) {
            if ($node->isVisible()) {
                $node->click();
                return;
            }
        }

        throw new ExpectationException(
            "No visible {$selectorString} element found.",
            $this->getSession()->getDriver()
        );
    }
public function clickFirstVisibleElementOfType($selectorString)
    {
        $page = $this->getSession()->getPage();
        /** @var NodeElement[] $nodes */
        $nodes = $page->findAll('css', $selectorString);
        foreach ($nodes as $node) {
            if ($node->isVisible()) {
                $node->click();
                return;
            }
        }

        throw new ExpectationException(
            "No visible {$selectorString} element found.",
            $this->getSession()->getDriver()
        );
    }
public function clickFirstVisibleElementOfType ( $ selectorString ) { $ page = $ this -> getSession ( ) -> getPage ( ) ; /** @var NodeElement[] $nodes */ $ nodes = $ page -> findAll ( 'css' , $ selectorString ) ; foreach ( $ nodes as $ node ) { if ( $ node -> isVisible ( ) ) { $ node -> click ( ) ; return ; } } throw new ExpectationException ( "No visible {$selectorString} element found." , $ this -> getSession ( ) -> getDriver ( ) ) ; }
Click the first visible element matching the css selector.

@When /^I click the first visible element matching "([^"]*)"$/

@param $selectorString
@throws ExpectationException
Click the first visible element matching the css selector .