Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. WebAssert.php

function WebAssert::elementNotContains

Checks that specific element does not contains HTML.

Parameters

string $selectorType element selector type (css, xpath):

string|array $selector element selector:

string $html expected text:

Return value

void

Throws

ElementHtmlException

ElementNotFoundException

File

vendor/behat/mink/src/WebAssert.php, line 588

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function elementNotContains(string $selectorType, $selector, string $html) {
    $element = $this->elementExists($selectorType, $selector);
    $actual = $element->getHtml();
    $regex = '/' . preg_quote($html, '/') . '/ui';
    $message = sprintf('The string "%s" appears in the HTML of the %s, but it should not.', $html, $this->getMatchingElementRepresentation($selectorType, $selector));
    $this->assertElement(!preg_match($regex, $actual), $message, $element);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal