You are here

protected function UiHelperTrait::click in Drupal 9

Same name and namespace in other branches
  1. 8 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.

22 calls to UiHelperTrait::click()
BackwardCompatibilityTest::testAjaxBackwardCompatibility in core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php
Ensures Drupal.Ajax.element_settings BC layer.
CKEditorIntegrationTest::testDrupalImageDialog in core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php
Tests if the Image button appears and works as expected.
ElementsTableSelectTest::testAjax in core/modules/system/tests/src/FunctionalJavascript/Form/ElementsTableSelectTest.php
Tests the presence of ajax functionality for all options.
FieldLayoutTest::testChangingFormatterAndRegion in core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php
Tests changing the formatter and region at the same time.
FieldLayoutTest::testEntityForm in core/modules/field_layout/tests/src/FunctionalJavascript/FieldLayoutTest.php
Tests the use of field layout for entity form displays.

... 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);
  }
}