Class ComboBoxElement

  • All Implemented Interfaces:
    com.vaadin.testbench.commands.CanCompareScreenshots, com.vaadin.testbench.commands.CanWaitForVaadin, com.vaadin.testbench.commands.TestBenchElementCommands, com.vaadin.testbench.HasDriver, com.vaadin.testbench.HasSearchContext, com.vaadin.testbench.HasTestBenchCommandExecutor, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebElement, org.openqa.selenium.WrapsElement
    Direct Known Subclasses:
    SelectElement

    public class ComboBoxElement
    extends AbstractSingleSelectElement
    • Constructor Summary

      Constructors 
      Constructor Description
      ComboBoxElement()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clear operation is not supported for select element classes.
      org.openqa.selenium.WebElement getInputField()
      Returns the text input field element, used for entering text into the combo box.
      List<org.openqa.selenium.WebElement> getPopupSuggestionElements()
      Gets the elements of all suggestions on the current page.
      List<String> getPopupSuggestions()
      Gets the text representation of all suggestions on the current page.
      org.openqa.selenium.WebElement getSuggestionPopup()
      Returns the suggestion popup element.
      String getText()  
      String getValue()
      Return value of the combo box element.
      boolean isPopupOpen()
      Checks whether the suggestion popup is open or not.
      boolean isTextInputAllowed()
      Checks if text input is allowed for the combo box.
      boolean openNextPage()
      Opens next popup page.
      void openPopup()
      Open the suggestion popup.
      boolean openPrevPage()
      Open previous popup page.
      void selectByText​(String text)
      Selects the first option in the ComboBox which matches the given text.
      void sendKeys​(int delay, CharSequence... keysToSend)
      Use this method to simulate typing into an element, which may set its value.
      void sendKeys​(CharSequence... keysToSend)  
      • Methods inherited from class com.vaadin.testbench.TestBenchElement

        click, click, clickHiddenElement, compareScreen, compareScreen, compareScreen, contextClick, doubleClick, equals, findElement, findElements, focus, getAccessibleName, getAriaRole, getAttribute, getCapabilities, getClassNames, getCommandExecutor, getContext, getCssValue, getDomAttribute, getDriver, getId, getLocation, getRect, getScreenshotAs, getShadowRoot, getSize, getTagName, getWrappedElement, hasAttribute, hasClassName, hashCode, init, init, isChrome, isDisplayed, isEnabled, isFirefox, isFocused, isSelected, scroll, scrollIntoView, scrollLeft, showTooltip, submit, waitForVaadin, waitUntil, waitUntil, wrap, wrapElement, wrapElements
      • Methods inherited from class com.vaadin.testbench.AbstractHasTestBenchCommandExecutor

        $, $$, isElementPresent, isElementPresent
      • Methods inherited from interface org.openqa.selenium.WebElement

        getDomProperty
    • Constructor Detail

      • ComboBoxElement

        public ComboBoxElement()
    • Method Detail

      • selectByText

        public void selectByText​(String text)
        Selects the first option in the ComboBox which matches the given text.
        Specified by:
        selectByText in class AbstractSingleSelectElement
        Parameters:
        text - the text of the option to select
      • isTextInputAllowed

        public boolean isTextInputAllowed()
        Checks if text input is allowed for the combo box.
        Returns:
        true if text input is allowed, false otherwise
      • isPopupOpen

        public boolean isPopupOpen()
        Checks whether the suggestion popup is open or not.
        Returns:
        true if popup is open, false if not
      • openPopup

        public void openPopup()
        Open the suggestion popup.
      • getPopupSuggestions

        public List<String> getPopupSuggestions()
        Gets the text representation of all suggestions on the current page.
        Returns:
        List of suggestion texts
      • getPopupSuggestionElements

        public List<org.openqa.selenium.WebElement> getPopupSuggestionElements()
        Gets the elements of all suggestions on the current page.

        Opens the popup if not already open.

        Returns:
        a list of elements for the suggestions on the current page
      • openNextPage

        public boolean openNextPage()
        Opens next popup page.
        Returns:
        True if next page opened. false if doesn't have next page
      • openPrevPage

        public boolean openPrevPage()
        Open previous popup page.
        Returns:
        True if previous page opened. False if doesn't have previous page
      • getSuggestionPopup

        public org.openqa.selenium.WebElement getSuggestionPopup()
        Returns the suggestion popup element.
      • getInputField

        public org.openqa.selenium.WebElement getInputField()
        Returns the text input field element, used for entering text into the combo box.
        Returns:
        the input field element
      • getText

        public String getText()
        Specified by:
        getText in interface org.openqa.selenium.WebElement
        Overrides:
        getText in class com.vaadin.testbench.TestBenchElement
      • clear

        public void clear()
        Description copied from class: AbstractSelectElement
        Clear operation is not supported for select element classes. This operation has no effect on select element
        Specified by:
        clear in interface org.openqa.selenium.WebElement
        Overrides:
        clear in class AbstractSelectElement
      • sendKeys

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

        public void sendKeys​(int delay,
                             CharSequence... keysToSend)
        Use this method to simulate typing into an element, which may set its value.
        Parameters:
        delay - delay after sending each individual key (mainly needed for PhantomJS)
        keysToSend - keys to type into the element