function RulesBrowserTestBase::clickLinkByHref
Clicks a link identified via partial href using xpath.
As the Rules UI pages become more complex, with multiple links and buttons containing the same text, it may get difficult to use clickLink('text', N) where N is the index position on the page, as the index of a given link varies depending on other rules. It is clearer to read and more future-proof to find the link via a known url fragment.
Parameters
string $href: The href, or a unique part of it.
3 calls to RulesBrowserTestBase::clickLinkByHref()
- ConfigureAndExecuteTest::testDeleteEventAndExecute in tests/
src/ Functional/ ConfigureAndExecuteTest.php - Tests deleting an event and then triggering its execution.
- ConfigureAndExecuteTest::testTwoRulesSameEvent in tests/
src/ Functional/ ConfigureAndExecuteTest.php - Tests creating and altering two rules reacting on the same event.
- UiPageTest::testDeleteEvent in tests/
src/ Functional/ UiPageTest.php - Tests that an event can be deleted.
File
-
tests/
src/ Functional/ RulesBrowserTestBase.php, line 42
Class
- RulesBrowserTestBase
- Has some additional helper methods to make test code more readable.
Namespace
Drupal\Tests\rules\FunctionalCode
public function clickLinkByHref($href) {
$this->getSession()
->getPage()
->find('xpath', './/a[contains(@href, "' . $href . '")]')
->click();
}