public function BrowserKitDriver::click 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::click()
Clicks button or link located by it's XPath query.
Parameters
string $xpath:
Throws
UnsupportedDriverActionException When operation not supported by the driver
DriverException When the operation cannot be done
Overrides CoreDriver::click
File
- vendor/
behat/ mink-browserkit-driver/ src/ BrowserKitDriver.php, line 470
Class
- BrowserKitDriver
- Symfony2 BrowserKit driver.
Namespace
Behat\Mink\DriverCode
public function click($xpath) {
$crawler = $this
->getFilteredCrawler($xpath);
$node = $this
->getCrawlerNode($crawler);
$tagName = $node->nodeName;
if ('a' === $tagName) {
$this->client
->click($crawler
->link());
$this->forms = array();
}
elseif ($this
->canSubmitForm($node)) {
$this
->submit($crawler
->form());
}
elseif ($this
->canResetForm($node)) {
$this
->resetForm($node);
}
else {
$message = sprintf('%%s supports clicking on links and submit or reset buttons only. But "%s" provided', $tagName);
throw new UnsupportedDriverActionException($message, $this);
}
}