@@ -494,17 +494,19 @@ public function elementTextNotContains($selectorType, $selector, $text)
494494 /**
495495 * Checks that specific element contains HTML.
496496 *
497- * @param string $selectorType element selector type (css, xpath)
498- * @param string|array $selector element selector
499- * @param string $html expected text
497+ * @param string $selectorType element selector type (css, xpath)
498+ * @param string|array $selector element selector
499+ * @param string $html expected text
500+ * @param bool $caseSensitive use case sensitive comparison
500501 *
501502 * @throws ElementHtmlException
502503 */
503- public function elementContains ($ selectorType , $ selector , $ html )
504+ public function elementContains ($ selectorType , $ selector , $ html, $ caseSensitive = false )
504505 {
505506 $ element = $ this ->elementExists ($ selectorType , $ selector );
506507 $ actual = $ element ->getHtml ();
507- $ regex = '/ ' .preg_quote ($ html , '/ ' ).'/ui ' ;
508+ $ regex = '/ ' .preg_quote ($ html , '/ ' ).'/u ' ;
509+ if ($ caseSensitive === false ) $ regex .= 'i ' ;
508510
509511 $ message = sprintf (
510512 'The string "%s" was not found in the HTML of the %s. ' ,
@@ -518,17 +520,19 @@ public function elementContains($selectorType, $selector, $html)
518520 /**
519521 * Checks that specific element does not contains HTML.
520522 *
521- * @param string $selectorType element selector type (css, xpath)
522- * @param string|array $selector element selector
523- * @param string $html expected text
523+ * @param string $selectorType element selector type (css, xpath)
524+ * @param string|array $selector element selector
525+ * @param string $html expected text
526+ * @param bool $caseSensitive use case sensitive comparison
524527 *
525528 * @throws ElementHtmlException
526529 */
527- public function elementNotContains ($ selectorType , $ selector , $ html )
530+ public function elementNotContains ($ selectorType , $ selector , $ html, $ caseSensitive = false )
528531 {
529532 $ element = $ this ->elementExists ($ selectorType , $ selector );
530533 $ actual = $ element ->getHtml ();
531- $ regex = '/ ' .preg_quote ($ html , '/ ' ).'/ui ' ;
534+ $ regex = '/ ' .preg_quote ($ html , '/ ' ).'/u ' ;
535+ if ($ caseSensitive === false ) $ regex .= 'i ' ;
532536
533537 $ message = sprintf (
534538 'The string "%s" appears in the HTML of the %s, but it should not. ' ,
0 commit comments