function UiHelperTrait::clickLink
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::clickLink()
- 10 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::clickLink()
- 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::clickLink()
- 8.9.x core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::clickLink()
Follows a link by complete name.
Will click the first link found with this link text.
If the link is discovered and clicked, the test passes. Fail otherwise.
Parameters
string|\Drupal\Component\Render\MarkupInterface $label: Text between the anchor tags.
int $index: (optional) The index number for cases where multiple links have the same text. Defaults to 0.
80 calls to UiHelperTrait::clickLink()
- AjaxBlockTest::testAddAjaxBlock in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ AjaxBlockTest.php - Tests configuring a field block for a user field.
- BlockFilterTest::testBlockFilter in core/
modules/ layout_builder/ tests/ src/ FunctionalJavascript/ BlockFilterTest.php - Tests block filter.
- ConfigTranslationCacheTest::testFieldConfigTranslation in core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationCacheTest.php - Tests the translation of field and field storage configuration.
- ConfigTranslationUiModulesTest::testBooleanFieldConfigTranslation in core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiModulesTest.php - Tests the translation of a boolean field settings.
- ConfigTranslationUiModulesTest::testFieldConfigTranslation in core/
modules/ config_translation/ tests/ src/ Functional/ ConfigTranslationUiModulesTest.php - Tests the translation of field and field storage configuration.
File
-
core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 455
Class
- UiHelperTrait
- Provides UI helper methods.
Namespace
Drupal\TestsCode
protected function clickLink($label, $index = 0) {
$label = (string) $label;
$links = $this->getSession()
->getPage()
->findAll('named', [
'link',
$label,
]);
$this->assertArrayHasKey($index, $links, 'The link ' . $label . ' was not found on the page.');
$links[$index]->click();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.