function UiHelperTrait::click

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()
  2. 10 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()
  3. 8.9.x core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()

Clicks the element with the given CSS selector.

Parameters

string $css_selector: The CSS selector identifying the element to click.

7 calls to UiHelperTrait::click()
MediaTest::testAlignment in core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php
Tests alignment integration.
MediaTest::testAlt in core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php
Tests the CKEditor 5 media plugin can override image media's alt attribute.
MediaTest::testAltDisabled in core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php
Tests that the image media source's alt_field being disabled is respected.
MediaTest::testDrupalMediaStyleInDropdown in core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php
Ensures that Drupal Media Styles can be displayed in a dropdown.
MediaTest::testEditableCaption in core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php
Tests caption editing in the CKEditor widget.

... See full list

File

core/tests/Drupal/Tests/UiHelperTrait.php, line 470

Class

UiHelperTrait
Provides UI helper methods.

Namespace

Drupal\Tests

Code

protected function click($css_selector) {
  $starting_url = $this->getSession()
    ->getCurrentUrl();
  $this->getSession()
    ->getDriver()
    ->click($this->cssSelectToXpath($css_selector));
  // Log only for WebDriverTestBase tests because for BrowserKitDriver we log
  // with ::getResponseLogHandler.
  if ($this->htmlOutputEnabled && !$this->isTestUsingGuzzleClient()) {
    $out = $this->getSession()
      ->getPage()
      ->getContent();
    $html_output = 'Clicked element with CSS selector: ' . $css_selector . '<hr />Starting URL: ' . $starting_url . '<hr />Ending URL: ' . $this->getSession()
      ->getCurrentUrl();
    $html_output .= '<hr />' . $out;
    $html_output .= $this->getHtmlOutputHeaders();
    $this->htmlOutput($html_output);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.