diff --git a/core/tests/Drupal/Tests/WebAssert.php b/core/tests/Drupal/Tests/WebAssert.php
index 8149551700..4b98a18517 100644
--- a/core/tests/Drupal/Tests/WebAssert.php
+++ b/core/tests/Drupal/Tests/WebAssert.php
@@ -416,6 +416,30 @@ public function assertEscaped($raw) {
     $this->responseContains(Html::escape($raw));
   }
 
+  /**
+   * Checks that page HTML (response content) contains text.
+   *
+   * @param string|object $text
+   *   Text value. Any non-string value will be cast to string.
+   *
+   * @throws ExpectationException
+   */
+  public function responseContains($text) {
+    parent::responseContains((string) $text);
+  }
+
+  /**
+   * Checks that page HTML (response content) does not contains text.
+   *
+   * @param string|object $text
+   *   Text value. Any non-string value will be cast to string.
+   *
+   * @throws ExpectationException
+   */
+  public function responseNotContains($text) {
+    parent::responseNotContains((string) $text);
+  }
+
   /**
    * Asserts a condition.
    *
