src/Concerns/InteractsWithPages.php
protected function filterByNameOrId($name, $elements = '*')
    {
        $name = str_replace('#', '', $name);

        $id = str_replace(['[', ']'], ['\\[', '\\]'], $name);

        $elements = is_array($elements) ? $elements : [$elements];

        array_walk($elements, function (&$element) use ($name, $id) {
            $element = "{$element}#{$id}, {$element}[name='{$name}']";
        });

        return $this->crawler()->filter(implode(', ', $elements));
    }
protected function filterByNameOrId($name, $elements = '*')
    {
        $name = str_replace('#', '', $name);

        $id = str_replace(['[', ']'], ['\\[', '\\]'], $name);

        $elements = is_array($elements) ? $elements : [$elements];

        array_walk($elements, function (&$element) use ($name, $id) {
            $element = "{$element}#{$id}, {$element}[name='{$name}']";
        });

        return $this->crawler()->filter(implode(', ', $elements));
    }
protected function filterByNameOrId ( $ name , $ elements = '*' ) { $ name = str_replace ( '#' , '' , $ name ) ; $ id = str_replace ( [ '[' , ']' ] , [ '\\[' , '\\]' ] , $ name ) ; $ elements = is_array ( $ elements ) ? $ elements : [ $ elements ] ; array_walk ( $ elements , function ( & $ element ) use ( $ name , $ id ) { $ element = "{$element}#{$id}, {$element}[name='{$name}']" ; } ) ; return $ this -> crawler ( ) -> filter ( implode ( ', ' , $ elements ) ) ; }
Filter elements according to the given name or ID attribute.

@param  string  $name
@param  array|string  $elements
@return \Symfony\Component\DomCrawler\Crawler
Filter elements according to the given name or ID attribute .