You are here

protected function WebTestBase::clickLink in SimpleTest 8.3

Follows a link by complete name.

Will click the first link found with this link text by default, or a later one if an index is given. Match is case sensitive with normalized space. The label is translated label.

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: Link position counting from zero.

Return value

string|bool Page contents on success, or FALSE on failure.

1 call to WebTestBase::clickLink()
BrowserTest::testGetAbsoluteUrl in src/Tests/BrowserTest.php
Test \Drupal\simpletest\WebTestBase::getAbsoluteUrl().

File

src/WebTestBase.php, line 1695

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function clickLink($label, $index = 0) {
  return $this
    ->clickLinkHelper($label, $index, '//a[normalize-space()=:label]');
}