public function TestSubContext::iClickLinkOrButton in Panopoly 7
@When I click :text link or button
File
- modules/
panopoly/ panopoly_test/ behat/ steps/ panopoly_test.behat.inc, line 778 - Provide Behat step-definitions for generic Panopoly tests.
Class
Code
public function iClickLinkOrButton($text) {
$link = $this
->getSession()
->getPage()
->findLink($text);
if ($link !== NULL) {
$link
->click();
return;
}
$button = $this
->getSession()
->getPage()
->findButton($text);
if ($button !== NULL) {
$button
->press();
return;
}
throw new \Exception(sprintf('The link or button "%s" was not found on the page %s', $text, $this
->getSession()
->getCurrentUrl()));
}