function WebAssert::elementContains
Checks that specific element contains HTML.
Parameters
string $selectorType element selector type (css, xpath):
string|array $selector element selector:
string $html expected text:
Return value
void
Throws
File
-
vendor/
behat/ mink/ src/ WebAssert.php, line 561
Class
- WebAssert
- Mink web assertions tool.
Namespace
Behat\MinkCode
public function elementContains(string $selectorType, $selector, string $html) {
$element = $this->elementExists($selectorType, $selector);
$actual = $element->getHtml();
$regex = '/' . preg_quote($html, '/') . '/ui';
$message = sprintf('The string "%s" was not found in the HTML of the %s.', $html, $this->getMatchingElementRepresentation($selectorType, $selector));
$this->assertElement((bool) preg_match($regex, $actual), $message, $element);
}