Class SelectElement

java.lang.Object
org.vaadin.addons.dramafinder.element.VaadinElement
org.vaadin.addons.dramafinder.element.SelectElement
All Implemented Interfaces:
Findable<SelectQuery<SelectElement>>, FocusableElement, HasAriaLabelElement, HasEnabledElement, HasHelperElement, HasInputFieldElement, HasLabelElement, HasLocatorElement, HasPlaceholderElement, HasPrefixElement, HasStyleElement, HasThemeElement, HasTooltipElement, HasValidationPropertiesElement, HasValueElement

PlaywrightElement for <vaadin-select>.

Provides helpers to open the overlay and pick items by visible text, along with aria/placeholder/validation mixins.

  • Field Details

  • Constructor Details

    • SelectElement

      public SelectElement(com.microsoft.playwright.Locator locator)
      Create a new SelectElement.
      Parameters:
      locator - the locator for the <vaadin-select> element
  • Method Details

    • getInputLocator

      public com.microsoft.playwright.Locator getInputLocator()
      Description copied from interface: HasValueElement
      Locator for the native input element inside the component.
      Specified by:
      getInputLocator in interface HasValueElement
    • selectItem

      public void selectItem(String item)
      Select an item by its visible label.
      Parameters:
      item - label of the item
    • getValue

      public String getValue()
      Get the selected value label for single-select.
      Specified by:
      getValue in interface HasValueElement
      Returns:
      the label of the value
    • getAriaLabelLocator

      public com.microsoft.playwright.Locator getAriaLabelLocator()
      Description copied from interface: HasAriaLabelElement
      Locator where the aria-label is applied. Defaults to root.
      Specified by:
      getAriaLabelLocator in interface HasAriaLabelElement
    • getAriaLabel

      public String getAriaLabel()
      Description copied from interface: HasAriaLabelElement
      Get the current aria-label value.
      Specified by:
      getAriaLabel in interface HasAriaLabelElement
    • assertAriaLabel

      public void assertAriaLabel(String ariaLabel)
      Description copied from interface: HasAriaLabelElement
      Assert that the aria-label matches the expected text, or is absent when null.
      Specified by:
      assertAriaLabel in interface HasAriaLabelElement
    • getFocusLocator

      public com.microsoft.playwright.Locator getFocusLocator()
      Description copied from interface: FocusableElement
      The locator to focus/blur. Defaults to the component root.
      Specified by:
      getFocusLocator in interface FocusableElement
    • getEnabledLocator

      public com.microsoft.playwright.Locator getEnabledLocator()
      Description copied from interface: HasEnabledElement
      Locator used to check enablement. Defaults to root.
      Specified by:
      getEnabledLocator in interface HasEnabledElement
    • assertPlaceholder

      public void assertPlaceholder(String placeholder)
      Description copied from interface: HasPlaceholderElement
      Assert that the placeholder matches the expected text.
      Specified by:
      assertPlaceholder in interface HasPlaceholderElement
    • assertValue

      public void assertValue(String expected)
      Assert the selected value label equals the expected string.
      Specified by:
      assertValue in interface HasValueElement
      Parameters:
      expected - expected label or empty for no selection
    • getByLabel

      public static SelectElement getByLabel(com.microsoft.playwright.Page page, String label)
      Get the SelectElement whose visible label is exactly label, searching the entire page.

      The label is the text of the component's own label slot, matched in full and case-sensitively. An aria-label or a placeholder is not a label: use find(page, SelectElement.class).withAccessibleName(..) or .withPlaceholder(..). No .first() is applied: two components with that label fail with a strict-mode error. Same as find(page, SelectElement.class).withLabel(label); use getByLabelContaining(Page, String) to match part of the label.

      Parameters:
      page - the Playwright page
      label - the full visible label
      Returns:
      the matching SelectElement
    • getByLabelContaining

      public static SelectElement getByLabelContaining(com.microsoft.playwright.Page page, String text)
      Get the SelectElement whose visible label contains text, searching the entire page.

      The label is matched case-insensitively as a substring; an aria-label or a placeholder is not a label. No .first() is applied: several matching components fail with a strict-mode error. Same as find(page, SelectElement.class).withLabelContaining(text).

      Parameters:
      page - the Playwright page
      text - part of the visible label
      Returns:
      the matching SelectElement
    • getByLabel

      public static SelectElement getByLabel(com.microsoft.playwright.Locator locator, String label)
      Get the SelectElement whose visible label is exactly label, scoped to the given locator.

      The label is the text of the component's own label slot, matched in full and case-sensitively. An aria-label or a placeholder is not a label: use find(locator, SelectElement.class).withAccessibleName(..) or .withPlaceholder(..). No .first() is applied: two components with that label fail with a strict-mode error. Same as find(locator, SelectElement.class).withLabel(label); use getByLabelContaining(Locator, String) to match part of the label.

      Parameters:
      locator - the locator whose subtree is searched
      label - the full visible label
      Returns:
      the matching SelectElement
    • getByLabelContaining

      public static SelectElement getByLabelContaining(com.microsoft.playwright.Locator locator, String text)
      Get the SelectElement whose visible label contains text, scoped to the given locator.

      The label is matched case-insensitively as a substring; an aria-label or a placeholder is not a label. No .first() is applied: several matching components fail with a strict-mode error. Same as find(locator, SelectElement.class).withLabelContaining(text).

      Parameters:
      locator - the locator whose subtree is searched
      text - part of the visible label
      Returns:
      the matching SelectElement
    • getById

      public static SelectElement getById(com.microsoft.playwright.Page page, String id)
      Get a SelectElement by its id, searching the entire page.

      A fallback for a component without a user-visible name: prefer the label or text lookups when there is one. The id must match in full; two components with that id fail with a strict-mode error.

      Parameters:
      page - the Playwright page
      id - the full id
      Returns:
      the matching SelectElement
    • getById

      public static SelectElement getById(com.microsoft.playwright.Locator locator, String id)
      Get a SelectElement by its id, scoped to the given locator.

      A fallback for a component without a user-visible name. The id must match in full; two components with that id inside the scope fail with a strict-mode error.

      Parameters:
      locator - the locator whose subtree is searched
      id - the full id
      Returns:
      the matching SelectElement
    • getByTestId

      public static SelectElement getByTestId(com.microsoft.playwright.Page page, String testId)
      Get a SelectElement by its test id, searching the entire page.

      The test id is Playwright's test id attribute, data-testid unless reconfigured — the attribute Flow's Component.setTestId(String) sets. A fallback for a component without a user-visible name; it must match in full, and two components with that test id fail with a strict-mode error.

      Parameters:
      page - the Playwright page
      testId - the full test id
      Returns:
      the matching SelectElement
    • getByTestId

      public static SelectElement getByTestId(com.microsoft.playwright.Locator locator, String testId)
      Get a SelectElement by its test id, scoped to the given locator.

      See getByTestId(Page, String); only components inside the scope are considered.

      Parameters:
      locator - the locator whose subtree is searched
      testId - the full test id
      Returns:
      the matching SelectElement