You are here

public function WebAssert::elementNotExists in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/behat/mink/src/WebAssert.php \Behat\Mink\WebAssert::elementNotExists()

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

Parameters

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

string|array $selector element selector:

ElementInterface $container document to check against:

Throws

ExpectationException

File

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

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function elementNotExists($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);
}