function 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|null $container document to check against:
Return value
Throws
6 calls to WebAssert::elementExists()
- WebAssert::elementAttributeExists in vendor/
behat/ mink/ src/ WebAssert.php - Checks that an attribute exists in an element.
- WebAssert::elementAttributeNotExists in vendor/
behat/ mink/ src/ WebAssert.php - Checks that an attribute does not exist 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.
File
-
vendor/
behat/ mink/ src/ WebAssert.php, line 455
Class
- WebAssert
- Mink web assertions tool.
Namespace
Behat\MinkCode
public function elementExists(string $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;
}