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)
| 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 |