You are here

public function WebAssert::elementExists in Zircon Profile 8

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

Checks that specific element exists on the current page.

Parameters

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

string|array $selector element selector:

ElementInterface $container document to check against:

Return value

NodeElement

Throws

ElementNotFoundException

5 calls to WebAssert::elementExists()
WebAssert::elementAttributeExists in vendor/behat/mink/src/WebAssert.php
Checks that an attribute exists in an element.
WebAssert::elementContains in vendor/behat/mink/src/WebAssert.php
Checks that specific element contains HTML.
WebAssert::elementNotContains in vendor/behat/mink/src/WebAssert.php
Checks that specific element does not contains HTML.
WebAssert::elementTextContains in vendor/behat/mink/src/WebAssert.php
Checks that specific element contains text.
WebAssert::elementTextNotContains in vendor/behat/mink/src/WebAssert.php
Checks that specific element does not contains text.

File

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

Class

WebAssert
Mink web assertions tool.

Namespace

Behat\Mink

Code

public function elementExists($selectorType, $selector, ElementInterface $container = null) {
  $container = $container ?: $this->session
    ->getPage();
  $node = $container
    ->find($selectorType, $selector);
  if (null === $node) {
    if (is_array($selector)) {
      $selector = implode(' ', $selector);
    }
    throw new ElementNotFoundException($this->session
      ->getDriver(), 'element', $selectorType, $selector);
  }
  return $node;
}