Created
May 23, 2019 15:25
-
-
Save bfodeke/99a4fc6c104e67d69faabaefe817474c to your computer and use it in GitHub Desktop.
Behat: Custom step to test clicking on an element with a class
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
/** | |
* Clicks on a css element. | |
* | |
* @Given I click the :arg1 element | |
*/ | |
public function iClickTheElement($selector) { | |
$page = $this->getSession()->getPage(); | |
$element = $page->find('css', $selector); | |
if (empty($element)) { | |
throw new Exception("No html element found for the selector ('$selector')"); | |
} | |
$element->click(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment