function AssertLegacyTrait::assertElementPresent

Same name in other branches
  1. 8.9.x core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertElementPresent()

Asserts that the element with the given CSS selector is present.

Parameters

string $css_selector: The CSS selector identifying the element to check.

Deprecated

in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->elementExists() instead.

See also

https://www.drupal.org/node/3129738

1 call to AssertLegacyTrait::assertElementPresent()
AssertLegacyTraitTest::testAssertElementPresent in core/tests/Drupal/Tests/Core/Assert/AssertLegacyTraitTest.php
@covers ::assertElementPresent

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 34

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertElementPresent($css_selector) {
    @trigger_error('AssertLegacyTrait::assertElementPresent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->elementExists() instead. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
    $this->assertSession()
        ->elementExists('css', $css_selector);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.