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

Label – the textual or symbolic element, which enables easy interactions with small elements, that are hard to click, such as checkboxes and radio-buttons. The state of element, to which label is bounded, changes after label receives a click.

Label

Labels and buttons are similar in scope of interactions with them, and thus labels and buttons have common set of methods.

Here is the list of available methods.

Method Description Return Type
click() Click on label void
getText() Retrieve label text String

Initialization:

@FindBy(xpath = "//label xpath")
public Label label;

Action > Examples:

@Test
public void clickLabelExample() {
    label.click();
}


@Test
public void getLabelTextExample() {
    String expected = "label text";
    String actual = label.getText();
    Assert.assertEquals(actual, expected);
}

See more examples on GitHub

Clone this wiki locally