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

Breadcrumb

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

function WebAssert::elementNotExists

Checks that specific element does not exist on the current page.

Parameters

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

string|array $selector element selector:

ElementInterface|null $container document to check against:

Return value

void

Throws

ExpectationException

File

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

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function elementNotExists(string $selectorType, $selector, ?ElementInterface $container = null) {
    $container = $container ?: $this->session
        ->getPage();
    $node = $container->find($selectorType, $selector);
    $message = sprintf('An %s appears on this page, but it should not.', $this->getMatchingElementRepresentation($selectorType, $selector));
    $this->assert(null === $node, $message);
}

API Navigation

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