Interface HasLabelFilter<C extends Component & HasLabel,SELF extends Locator<C,SELF>>

Type Parameters:
C - the component type, bound to HasLabel
SELF - the concrete locator subtype, used for fluent chaining
All Known Implementing Classes:
BigDecimalFieldLocator, CheckboxGroupLocator, CheckboxLocator, ComboBoxLocator, DatePickerLocator, DateTimePickerLocator, DecimalRangeSliderLocator, DecimalSliderLocator, EmailFieldLocator, IntegerFieldLocator, IntegerRangeSliderLocator, IntegerSliderLocator, MultiSelectComboBoxLocator, NumberFieldLocator, PasswordFieldLocator, RadioButtonGroupLocator, SelectLocator, SwitchLocator, TextAreaLocator, TextFieldLocator, TimePickerLocator

public interface HasLabelFilter<C extends Component & HasLabel,SELF extends Locator<C,SELF>>
Mixin for Locators whose target component implements HasLabel. Exposes label-based filter methods that would be meaningless on components without a label, turning a call like findButton().withLabel("Save") (Button is HasText, not HasLabel) into a compile error rather than a silent no-op.
Since:
1.1
  • Method Summary

    Modifier and Type
    Method
    Description
    default SELF
    Requires the matched component's label to be exactly the given value.
    default SELF
    Requires the matched component's label to contain the given text.
  • Method Details

    • withLabel

      default SELF withLabel(String label)
      Requires the matched component's label to be exactly the given value. Use this for form fields where the end user identifies a field by its label. The label is resolved as described in ElementConditions.hasLabel(String), which also covers <label for> elements and form item labels.
      Parameters:
      label - the expected label
      Returns:
      this locator, for chaining
    • withLabelContaining

      default SELF withLabelContaining(String text)
      Requires the matched component's label to contain the given text. The label is resolved in the same way as in withLabel(String).
      Parameters:
      text - the expected text
      Returns:
      this locator, for chaining