function UiHelperTrait::click
Same name in other branches
- 9 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()
- 10 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()
- 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.
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 - Test 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.
File
-
core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 463
Class
- UiHelperTrait
- Provides UI helper methods.
Namespace
Drupal\TestsCode
protected function click($css_selector) {
$starting_url = $this->getSession()
->getCurrentUrl();
$this->getSession()
->getDriver()
->click($this->cssSelectToXpath($css_selector));
// Log only for JavascriptTestBase tests because for Goutte we log with
// ::getResponseLogHandler.
if ($this->htmlOutputEnabled && !$this->getSession()
->getDriver() instanceof GoutteDriver) {
$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.