Created
June 11, 2021 08:34
-
-
Save asolntsev/4501cc56f4e62925c5f060c983970231 to your computer and use it in GitHub Desktop.
This file contains 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
@Test | |
public void test42() { | |
$("#random-username").shouldHave(new TextOfLength(42)); | |
} | |
private static class TextOfLength extends Condition { | |
private final int expectedLength; | |
public TextOfLength(int expectedLength) { | |
super("text if length " + expectedLength); | |
this.expectedLength = expectedLength; | |
} | |
@Override public boolean apply(@Nonnull Driver driver, @Nonnull WebElement webElement) { | |
return webElement.getText().length() == expectedLength; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment