You are here

protected function BrowserKitDriver::getFormField in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php \Behat\Mink\Driver\BrowserKitDriver::getFormField()

Returns form field from XPath query.

Parameters

string $xpath:

Return value

FormField

Throws

DriverException

6 calls to BrowserKitDriver::getFormField()
BrowserKitDriver::attachFile in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Attaches file path to file field located by it's XPath query.
BrowserKitDriver::getCheckboxField in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Returns the checkbox field from xpath query, ensuring it is valid.
BrowserKitDriver::getValue in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Returns element's value by it's XPath query.
BrowserKitDriver::isChecked in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Checks whether checkbox or radio button located by it's XPath query is checked.
BrowserKitDriver::isSelected in vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php
Checks whether select option, located by it's XPath query, is selected.

... See full list

File

vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php, line 574

Class

BrowserKitDriver
Symfony2 BrowserKit driver.

Namespace

Behat\Mink\Driver

Code

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];
}