protected function clickByLocator($link)
{
$nodes = $this->match($link);
if (!$nodes->count()) {
throw new ElementNotFound($link, 'Link or Button by name or CSS or XPath');
}
foreach ($nodes as $node) {
$tag = $node->nodeName;
$type = $node->getAttribute('type');
if ($tag == 'a') {
$this->crawler = $this->client->click($nodes->first()->link());
$this->forms = [];
$this->debugResponse();
return;
} elseif(
($tag == 'input' && in_array($type, array('submit', 'image'))) ||
($tag == 'button' && $type == 'submit'))
{
$this->submitFormWithButton($nodes->first());
$this->debugResponse();
return;
}
}
}