If the element has an ID tag then you can use code below to click it.


FeatureContext.php


use Behat\MinkExtension\Context\MinkContext;

class FeatureContext extends MinkContext
{
/**
* @When /^I click an element with ID "([^"]*)"$/
*
* @param $id
* @throws \Exception
*/
public function iClickAnElementWithId($id)
{
$element = $this->getSession()->getPage()->findById($id);
if (null === $element) {
throw new \Exception(sprintf('Could not evaluate element with ID: "%s"', $id));
}
$element->click();
}
}