Skip to content

Instantly share code, notes, and snippets.

@IsmagilovQA
Created November 8, 2022 14:55
Show Gist options
  • Save IsmagilovQA/82825bff66f0a9143d79409264bac17c to your computer and use it in GitHub Desktop.
Save IsmagilovQA/82825bff66f0a9143d79409264bac17c to your computer and use it in GitHub Desktop.
Selenide - custom condition: textIgnoreSpaces
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