Class SelectElement
- All Implemented Interfaces:
Findable<SelectQuery<SelectElement>>,FocusableElement,HasAriaLabelElement,HasEnabledElement,HasHelperElement,HasInputFieldElement,HasLabelElement,HasLocatorElement,HasPlaceholderElement,HasPrefixElement,HasStyleElement,HasThemeElement,HasTooltipElement,HasValidationPropertiesElement,HasValueElement
<vaadin-select>.
Provides helpers to open the overlay and pick items by visible text, along with aria/placeholder/validation mixins.
-
Field Summary
FieldsFields inherited from class org.vaadin.addons.dramafinder.element.VaadinElement
locator -
Constructor Summary
ConstructorsConstructorDescriptionSelectElement(com.microsoft.playwright.Locator locator) Create a newSelectElement. -
Method Summary
Modifier and TypeMethodDescriptionvoidassertAriaLabel(String ariaLabel) Assert that thearia-labelmatches the expected text, or is absent when null.voidassertPlaceholder(String placeholder) Assert that theplaceholdermatches the expected text.voidassertValue(String expected) Assert the selected value label equals the expected string.Get the currentaria-labelvalue.com.microsoft.playwright.LocatorLocator where thearia-labelis applied.static SelectElementGet aSelectElementby itsid, scoped to the given locator.static SelectElementGet aSelectElementby itsid, searching the entire page.static SelectElementgetByLabel(com.microsoft.playwright.Locator locator, String label) Get theSelectElementwhose visible label is exactlylabel, scoped to the given locator.static SelectElementgetByLabel(com.microsoft.playwright.Page page, String label) Get theSelectElementwhose visible label is exactlylabel, searching the entire page.static SelectElementgetByLabelContaining(com.microsoft.playwright.Locator locator, String text) Get theSelectElementwhose visible label containstext, scoped to the given locator.static SelectElementgetByLabelContaining(com.microsoft.playwright.Page page, String text) Get theSelectElementwhose visible label containstext, searching the entire page.static SelectElementgetByTestId(com.microsoft.playwright.Locator locator, String testId) Get aSelectElementby its test id, scoped to the given locator.static SelectElementgetByTestId(com.microsoft.playwright.Page page, String testId) Get aSelectElementby its test id, searching the entire page.com.microsoft.playwright.LocatorLocator used to check enablement.com.microsoft.playwright.LocatorThe locator to focus/blur.com.microsoft.playwright.LocatorLocator for the native input element inside the component.getValue()Get the selected value label for single-select.voidselectItem(String item) Select an item by its visible label.Methods inherited from class org.vaadin.addons.dramafinder.element.VaadinElement
assertHidden, assertVisible, assertVisible, click, find, getLocator, getProperty, getText, isHidden, isVisible, isVisible, setPropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.FocusableElement
assertIsFocused, assertIsNotFocused, blur, focus, getTabIndexMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasEnabledElement
assertDisabled, assertEnabled, assertEnabled, isEnabled, isEnabledMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasHelperElement
assertHelperHasText, getHelperLocator, getHelperTextMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasLabelElement
assertLabel, getLabel, getLabelLocatorMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasLocatorElement
getLocator, waitAfterAction, waitForVaadinIdleMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasPlaceholderElement
getPlaceholder, setPlaceholderMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasPrefixElement
assertPrefixHasText, getPrefixLocator, getPrefixTextMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasStyleElement
assertCssClass, getCssClassMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasThemeElement
assertHasNoThemeVariant, assertHasThemeVariant, assertTheme, getThemeMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasTooltipElement
assertTooltipHasText, getTooltip, getTooltipLocator, getTooltipTextMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasValidationPropertiesElement
assertErrorMessage, assertInvalid, assertValid, getErrorMessageLocatorMethods inherited from interface org.vaadin.addons.dramafinder.element.shared.HasValueElement
clear, setValue
-
Field Details
-
FIELD_TAG_NAME
- See Also:
-
FIELD_ITEM_TAG_NAME
- See Also:
-
FIELD_OVERLAY_TAG_NAME
- See Also:
-
-
Constructor Details
-
SelectElement
public SelectElement(com.microsoft.playwright.Locator locator) Create a newSelectElement.- Parameters:
locator- the locator for the<vaadin-select>element
-
-
Method Details
-
getInputLocator
public com.microsoft.playwright.Locator getInputLocator()Description copied from interface:HasValueElementLocator for the native input element inside the component.- Specified by:
getInputLocatorin interfaceHasValueElement
-
selectItem
Select an item by its visible label.- Parameters:
item- label of the item
-
getValue
Get the selected value label for single-select.- Specified by:
getValuein interfaceHasValueElement- Returns:
- the label of the value
-
getAriaLabelLocator
public com.microsoft.playwright.Locator getAriaLabelLocator()Description copied from interface:HasAriaLabelElementLocator where thearia-labelis applied. Defaults to root.- Specified by:
getAriaLabelLocatorin interfaceHasAriaLabelElement
-
getAriaLabel
Description copied from interface:HasAriaLabelElementGet the currentaria-labelvalue.- Specified by:
getAriaLabelin interfaceHasAriaLabelElement
-
assertAriaLabel
Description copied from interface:HasAriaLabelElementAssert that thearia-labelmatches the expected text, or is absent when null.- Specified by:
assertAriaLabelin interfaceHasAriaLabelElement
-
getFocusLocator
public com.microsoft.playwright.Locator getFocusLocator()Description copied from interface:FocusableElementThe locator to focus/blur. Defaults to the component root.- Specified by:
getFocusLocatorin interfaceFocusableElement
-
getEnabledLocator
public com.microsoft.playwright.Locator getEnabledLocator()Description copied from interface:HasEnabledElementLocator used to check enablement. Defaults to root.- Specified by:
getEnabledLocatorin interfaceHasEnabledElement
-
assertPlaceholder
Description copied from interface:HasPlaceholderElementAssert that theplaceholdermatches the expected text.- Specified by:
assertPlaceholderin interfaceHasPlaceholderElement
-
assertValue
Assert the selected value label equals the expected string.- Specified by:
assertValuein interfaceHasValueElement- Parameters:
expected- expected label or empty for no selection
-
getByLabel
Get theSelectElementwhose visible label is exactlylabel, searching the entire page.The label is the text of the component's own
labelslot, matched in full and case-sensitively. Anaria-labelor a placeholder is not a label: usefind(page, SelectElement.class).withAccessibleName(..)or.withPlaceholder(..). No.first()is applied: two components with that label fail with a strict-mode error. Same asfind(page, SelectElement.class).withLabel(label); usegetByLabelContaining(Page, String)to match part of the label.- Parameters:
page- the Playwright pagelabel- the full visible label- Returns:
- the matching
SelectElement
-
getByLabelContaining
Get theSelectElementwhose visible label containstext, searching the entire page.The label is matched case-insensitively as a substring; an
aria-labelor a placeholder is not a label. No.first()is applied: several matching components fail with a strict-mode error. Same asfind(page, SelectElement.class).withLabelContaining(text).- Parameters:
page- the Playwright pagetext- part of the visible label- Returns:
- the matching
SelectElement
-
getByLabel
Get theSelectElementwhose visible label is exactlylabel, scoped to the given locator.The label is the text of the component's own
labelslot, matched in full and case-sensitively. Anaria-labelor a placeholder is not a label: usefind(locator, SelectElement.class).withAccessibleName(..)or.withPlaceholder(..). No.first()is applied: two components with that label fail with a strict-mode error. Same asfind(locator, SelectElement.class).withLabel(label); usegetByLabelContaining(Locator, String)to match part of the label.- Parameters:
locator- the locator whose subtree is searchedlabel- the full visible label- Returns:
- the matching
SelectElement
-
getByLabelContaining
public static SelectElement getByLabelContaining(com.microsoft.playwright.Locator locator, String text) Get theSelectElementwhose visible label containstext, scoped to the given locator.The label is matched case-insensitively as a substring; an
aria-labelor a placeholder is not a label. No.first()is applied: several matching components fail with a strict-mode error. Same asfind(locator, SelectElement.class).withLabelContaining(text).- Parameters:
locator- the locator whose subtree is searchedtext- part of the visible label- Returns:
- the matching
SelectElement
-
getById
Get aSelectElementby itsid, 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 pageid- the fullid- Returns:
- the matching
SelectElement
-
getById
Get aSelectElementby itsid, 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 searchedid- the fullid- Returns:
- the matching
SelectElement
-
getByTestId
Get aSelectElementby its test id, searching the entire page.The test id is Playwright's test id attribute,
data-testidunless reconfigured — the attribute Flow'sComponent.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 pagetestId- the full test id- Returns:
- the matching
SelectElement
-
getByTestId
Get aSelectElementby 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 searchedtestId- the full test id- Returns:
- the matching
SelectElement
-