code: 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;
      }
docs: Find all field labels by text.
  
  @param string $text
  Label text.
  
  @return NodeElement[]