Created
September 14, 2012 09:29
-
-
Save MikePearce/3721000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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