function UiHelperTrait::click

Same name in other branches
  1. 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()
  2. 8.9.x core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()
  3. 11.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.

34 calls to UiHelperTrait::click()
AjaxTest::testGlobalEvents in core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
Tests that jQuery's global Ajax events are triggered at the correct time.
AjaxTest::testUiAjaxException in core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxTest.php
Tests that Ajax errors are visible in the UI.
CKEditor5MarkupTest::testAttributeEncoding in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5MarkupTest.php
Ensures that attribute values are encoded.
CKEditor5Test::testEditorFileReferenceIntegration in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php
Ensures that CKEditor 5 integrates with file reference filter.
CKEditor5Test::testListPlugin in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php
Tests list plugin.

... See full list

File

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

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.