Skip to content

Instantly share code, notes, and snippets.

@MikePearce
Created September 14, 2012 09:29
Show Gist options
  • Save MikePearce/3721000 to your computer and use it in GitHub Desktop.
Save MikePearce/3721000 to your computer and use it in GitHub Desktop.
/**
* Click link or button to trigger js event
* (for buttons that submit forms, use "press"
*
* @When /^I click on the text "([^"]*)"$/
*/
public function iClickOnTheText($text)
{
$session = $this->getSession();
$element = $session->getPage()->find(
'named',
array(
'content', $session->getSelectorsHandler()->xpathLiteral($text)
)
);
if (null === $element) {
throw new \InvalidArgumentException(sprintf('Cannot find text: "%s"', $text));
}
$element->click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment