Skip to content
Taisiia-Kozlova edited this page Nov 7, 2017 · 3 revisions

Text is a combination of letters and textual symbols. When performing testing, text is used in most operations: when typing text into login-field, finding a button with some certain text in it, or checking if actual text matches expected one.

Example:

Text

Here is the list of available methods.

Method Description Return Type
getText() Get element’s text String
waitText(String) Wait while element’s text contains expected text. Returns element’s text String
waitMatchText(String) Wait while element’s text matches regEx. Returns element’s text String

Initialization:

@FindBy(xpath = "//text xpath")
public Text text;

Action > Examples:

@Test
public void getTextExample() {
    String expected = "this is the text we expect to see";
    String actual = text.getText();
    Assert.assertEquals(actual, expected);
}

See more examples on GitHub

Clone this wiki locally