protected function getFormField($xpath)
    {
        $fieldNode = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
        $fieldName = str_replace('[]', '', $fieldNode->getAttribute('name'));

        $formNode = $this->getFormNode($fieldNode);
        $formId = $this->getFormNodeId($formNode);

        if (!isset($this->forms[$formId])) {
            $this->forms[$formId] = new Form($formNode, $this->getCurrentUrl());
        }

        if (is_array($this->forms[$formId][$fieldName])) {
            return $this->forms[$formId][$fieldName][$this->getFieldPosition($fieldNode)];
        }

        return $this->forms[$formId][$fieldName];
    }
protected function getFormField($xpath)
    {
        $fieldNode = $this->getCrawlerNode($this->getFilteredCrawler($xpath));
        $fieldName = str_replace('[]', '', $fieldNode->getAttribute('name'));

        $formNode = $this->getFormNode($fieldNode);
        $formId = $this->getFormNodeId($formNode);

        if (!isset($this->forms[$formId])) {
            $this->forms[$formId] = new Form($formNode, $this->getCurrentUrl());
        }

        if (is_array($this->forms[$formId][$fieldName])) {
            return $this->forms[$formId][$fieldName][$this->getFieldPosition($fieldNode)];
        }

        return $this->forms[$formId][$fieldName];
    }
protected function getFormField ( $ xpath ) { $ fieldNode = $ this -> getCrawlerNode ( $ this -> getFilteredCrawler ( $ xpath ) ) ; $ fieldName = str_replace ( '[]' , '' , $ fieldNode -> getAttribute ( 'name' ) ) ; $ formNode = $ this -> getFormNode ( $ fieldNode ) ; $ formId = $ this -> getFormNodeId ( $ formNode ) ; if ( ! isset ( $ this -> forms [ $ formId ] ) ) { $ this -> forms [ $ formId ] = new Form ( $ formNode , $ this -> getCurrentUrl ( ) ) ; } if ( is_array ( $ this -> forms [ $ formId ] [ $ fieldName ] ) ) { return $ this -> forms [ $ formId ] [ $ fieldName ] [ $ this -> getFieldPosition ( $ fieldNode ) ] ; } return $ this -> forms [ $ formId ] [ $ fieldName ] ; }
Returns form field from XPath query.

@param string $xpath

@return FormField

@throws DriverException
Returns form field from XPath query .