src/Context/RawPageContext.php
public function findLabels($text)
    {
        $xpath = new XPath\InaccurateText('//label[@for]', $this->getWorkingElement());
        $labels = [];

        foreach ($xpath->text($text)->findAll() as $label) {
            $labels[$label->getAttribute('for')] = $label;
        }

        return $labels;
    }
public function findLabels($text)
    {
        $xpath = new XPath\InaccurateText('//label[@for]', $this->getWorkingElement());
        $labels = [];

        foreach ($xpath->text($text)->findAll() as $label) {
            $labels[$label->getAttribute('for')] = $label;
        }

        return $labels;
    }
public function findLabels ( $ text ) { $ xpath = new XPath \ InaccurateText ( '//label[@for]' , $ this -> getWorkingElement ( ) ) ; $ labels = [ ] ; foreach ( $ xpath -> text ( $ text ) -> findAll ( ) as $ label ) { $ labels [ $ label -> getAttribute ( 'for' ) ] = $ label ; } return $ labels ; }
Find all field labels by text.

@param string $text
Label text.

@return NodeElement[]
Find all field labels by text .