public function FeatureContext::iClickTheLinkWithText in Open Social 8.4
Same name and namespace in other branches
- 8.9 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 8.3 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 8.5 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 8.6 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 8.7 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 8.8 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 10.3.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 10.0.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 10.1.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
- 10.2.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::iClickTheLinkWithText()
@When I click the xth :position link with the text :locator
File
- tests/
behat/ features/ bootstrap/ FeatureContext.php, line 261
Class
- FeatureContext
- Defines application features from the specific context.
Namespace
Drupal\social\BehatCode
public function iClickTheLinkWithText($position, $locator) {
$session = $this
->getSession();
$links = $session
->getPage()
->findAll('named', array(
'link',
$locator,
));
$count = 1;
foreach ($links as $link) {
if ($count == $position) {
// Now click the element.
$link
->click();
return;
}
$count++;
}
throw new \InvalidArgumentException(sprintf('Element not found with the locator: "%s"', $locator));
}