MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / assertTextPresent

Method assertTextPresent

src/main/java/org/htmlunit/WebAssert.java:189–194  ·  view source on GitHub ↗

Verifies that the specified page contains the specified text. @param page the page to check @param text the text to check for @throws AssertionError if the page does not contain the specified text @throws NullPointerException if page or text is null

(final HtmlPage page, final String text)

Source from the content-addressed store, hash-verified

187 * @throws NullPointerException if page or text is null
188 */
189 public static void assertTextPresent(final HtmlPage page, final String text) {
190 if (!page.asNormalizedText().contains(text)) {
191 final String msg = "Expected text '" + text + "' was not found on the page.";
192 throw new AssertionError(msg);
193 }
194 }
195
196 /**
197 * Verifies that the element on the specified page which matches the specified ID contains the

Callers 1

assertTextPresentMethod · 0.95

Calls 2

containsMethod · 0.65
asNormalizedTextMethod · 0.45

Tested by 1

assertTextPresentMethod · 0.76