Class ComboBoxElement

java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.combobox.testbench.ComboBoxElement
All Implemented Interfaces:
CanCompareScreenshots, HasCallFunction, HasClearButton, HasDriver, HasElementQuery, HasHelper, HasLabel, HasPlaceholder, HasPropertySettersGetters, HasSearchContext, HasSelectByText, HasTestBenchCommandExecutor, HasValidation, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebElement, org.openqa.selenium.WrapsElement

A TestBench element representing a <vaadin-combo-box> element.
  • Constructor Details

    • ComboBoxElement

      public ComboBoxElement()
  • Method Details

    • clear

      public void clear()
      Clears the value of the combobox.
      Specified by:
      clear in interface org.openqa.selenium.WebElement
      Overrides:
      clear in class TestBenchElement
    • setValue

      protected void setValue(String value)
      Sets the property "value" as a string.

      Parameters:
      value - the value to set
    • getValue

      protected String getValue()
      Gets the property "value" as a string.

      Returns:
      the value of the combobox or an empty string if no value is selected
    • selectByText

      public void selectByText(String text)
      Description copied from interface: HasSelectByText
      Selects the first option matching the given text.
      Specified by:
      selectByText in interface HasSelectByText
      Parameters:
      text - the text of the option to select
    • getSelectedText

      public String getSelectedText()
      Description copied from interface: HasSelectByText
      Gets the text of the currently selected option.
      Specified by:
      getSelectedText in interface HasSelectByText
      Returns:
      the text of the current option
    • getInputElementValue

      public String getInputElementValue()
    • openPopup

      public void openPopup()
      Opens the popup with options, if it is not already open.
    • closePopup

      public void closePopup()
      Close the popup with options, if it is open.
    • isPopupOpen

      public boolean isPopupOpen()
      Checks whether the popup with options is open.
      Returns:
      true if the popup is open, false otherwiseF
    • getOptions

      public List<String> getOptions()
      Gets the labels of the items that are currently loaded in the popup. Opens the popup if it is not open.

      The popup only holds the pages that are loaded so far. Items outside them are placeholders with an empty label.

      Returns:
      labels of the items that are loaded in the popup
    • setFilter

      public void setFilter(String filter)
      Sets the filter for the options in the popup.
      Parameters:
      filter - the filter to use for filtering options
    • getFilter

      public String getFilter()
      Gets the filter for the options in the popup.
      Returns:
      the filter to use for filtering options
    • isAutoOpen

      public boolean isAutoOpen()
      Gets whether dropdown will open automatically or not.
      Returns:
      true if enabled, false otherwise
    • sendKeys

      public void sendKeys(CharSequence... keysToSend)
      Specified by:
      sendKeys in interface org.openqa.selenium.WebElement
      Overrides:
      sendKeys in class TestBenchElement