public function BrowserKitDriver::getValue in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/behat/mink-browserkit-driver/src/BrowserKitDriver.php \Behat\Mink\Driver\BrowserKitDriver::getValue()
Returns element's value by it's XPath query.
Parameters
string $xpath:
Return value
string|bool|array
Throws
UnsupportedDriverActionException When operation not supported by the driver
DriverException When the operation cannot be done
Overrides CoreDriver::getValue
See also
\Behat\Mink\Element\NodeElement::getValue
File
- vendor/
behat/ mink-browserkit-driver/ src/ BrowserKitDriver.php, line 390
Class
- BrowserKitDriver
- Symfony2 BrowserKit driver.
Namespace
Behat\Mink\DriverCode
public function getValue($xpath) {
if (in_array($this
->getAttribute($xpath, 'type'), array(
'submit',
'image',
'button',
), true)) {
return $this
->getAttribute($xpath, 'value');
}
$node = $this
->getCrawlerNode($this
->getFilteredCrawler($xpath));
if ('option' === $node->tagName) {
return $this
->getOptionValue($node);
}
try {
$field = $this
->getFormField($xpath);
} catch (\InvalidArgumentException $e) {
return $this
->getAttribute($xpath, 'value');
}
return $field
->getValue();
}