Created
November 8, 2022 14:55
-
-
Save IsmagilovQA/82825bff66f0a9143d79409264bac17c to your computer and use it in GitHub Desktop.
Selenide - custom condition: textIgnoreSpaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static Condition textIgnoreSpaces(String text) { | |
| return new Condition("text with spaces" + text) { | |
| @Override | |
| @Nonnull | |
| public CheckResult check(Driver driver, WebElement element) { | |
| String textWithSpaces = element.getText(); | |
| return new CheckResult(textWithSpaces.replaceAll("\\s+", "").equals(text), textWithSpaces); | |
| } | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment