protected function UiHelperTrait::click in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/UiHelperTrait.php \Drupal\Tests\UiHelperTrait::click()
- 9 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.
6 calls to UiHelperTrait::click()
- ElementsTableSelectTest::testAjax in core/
modules/ system/ tests/ src/ FunctionalJavascript/ Form/ ElementsTableSelectTest.php - Tests the presence of ajax functionality for all options.
- InstallProfileDependenciesTest::testUninstallingModules in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallProfileDependenciesTest.php - Tests that an install profile can require modules.
- JsMessageTest::testAddRemoveMessages in core/
tests/ Drupal/ FunctionalJavascriptTests/ Core/ JsMessageTest.php - Tests click on links to show messages and remove messages.
- OliveroMessagesTest::testDataDrupalSelectors in core/
tests/ Drupal/ FunctionalJavascriptTests/ Theme/ OliveroMessagesTest.php - Tests data-drupal-selector="messages" exists.
- TaxonomyRelationshipTest::testTaxonomyRelationships in core/
modules/ taxonomy/ tests/ src/ Functional/ Views/ TaxonomyRelationshipTest.php - Tests the taxonomy parent plugin UI.
File
- core/
tests/ Drupal/ Tests/ UiHelperTrait.php, line 373
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 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);
}
}