function UiHelperTrait::click

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

39 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.
BackwardCompatibilityTest::testAjaxBackwardCompatibility in core/tests/Drupal/FunctionalJavascriptTests/Ajax/BackwardCompatibilityTest.php
Ensures Drupal.Ajax.element_settings BC layer.
CKEditor5IntegrationTest::testArticleNode in core/modules/quickedit/tests/src/FunctionalJavascript/CKEditor5IntegrationTest.php
Tests if an article node can be in-place edited with Quick Edit.
CKEditor5IntegrationTest::testDiscard in core/modules/quickedit/tests/src/FunctionalJavascript/CKEditor5IntegrationTest.php
Tests that changes can be discarded.
CKEditor5Test::testAttributeEncoding in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php
Ensures that attribute values are encoded.

... 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.