public class ComboBox extends Component
Modifier and Type | Class and Description |
---|---|
protected static class |
ComboBox.AbstractSelect |
protected static class |
ComboBox.DojoSelect
Models a dojo Combo Box.
|
protected static class |
ComboBox.DojoSelect_ComboBox
Models a dojo dijit/form/ComboBox
|
protected static class |
ComboBox.DojoSelect_FilteringSelect
Models a dojo dijit/form/FilteringSelect
|
protected static class |
ComboBox.DojoSelect_Select
Models a dojo dijit/form/Select
|
protected static class |
ComboBox.HtmlSelect
Modified from Source code of Selenium.
Models a SELECT tag, providing helper methods to select and deselect options. |
static class |
ComboBox.SapSelect_ComboBox |
static interface |
ComboBox.Selectable
This interface wraps different kinds of ComboBox, and it provides the uniform methods.
In the class ComboBox, we call these uniform methods. Jan 15, 2014 (Lei Wang) Initial release. |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_DOJO_COMBOBOX |
static java.lang.String |
CLASS_DOJO_SELECT |
static java.lang.String |
CLASS_HTML_SELECT |
static int |
DEFAULT_MAX_REFRESH_TIMES |
static java.lang.String |
ITEM_SEPARATOR |
static int |
MAX_REFRESH_TIMES |
(package private) ComboBox.Selectable |
select |
accessible, anOperableObject, ATTRIBUTE_CLASS, ATTRIBUTE_DIJITPOPUPPARENT, ATTRIBUTE_ID, ATTRIBUTE_INDEX, ATTRIBUTE_MULTIPLE, ATTRIBUTE_NAME, ATTRIBUTE_TEXT, ATTRIBUTE_TYPE, ATTRIBUTE_VALUE, ATTRIBUTE_VISIBILITY, ATTRIBUTE_WIDGETID, delayGetContent, dijitpopupparent, operableObjects, TAG_HTML_INPUT, TAG_HTML_SELECT, VALUE_CHECKBOX_ATTRIBUTE_TYPE, VALUE_PASSWORD_ATTRIBUTE_TYPE, VALUE_RADIO_ATTRIBUTE_TYPE, VALUE_SUBMIT_ATTRIBUTE_TYPE, VALUE_TEXT_ATTRIBUTE_TYPE, VALUE_VISIBILITY_HIDDEN, VALUE_VISIBILITY_VISIBLE, waiRole, widgetid
cssClass, id, map, object, possibleRecognitionStrings, searchContext, tagName, webelement
ATTRIBUTE_ARIA_ACTIVEDDESCENDANT, ATTRIBUTE_ARIA_ATOMIC, ATTRIBUTE_ARIA_AUTOCOMPLETE, ATTRIBUTE_ARIA_BUSY, ATTRIBUTE_ARIA_CHECKED, ATTRIBUTE_ARIA_CONTROLS, ATTRIBUTE_ARIA_DESCRIBEDBY, ATTRIBUTE_ARIA_DISABLED, ATTRIBUTE_ARIA_DRIPEFFECT, ATTRIBUTE_ARIA_EXPANDED, ATTRIBUTE_ARIA_FLOWTO, ATTRIBUTE_ARIA_GRABBED, ATTRIBUTE_ARIA_HASPOPUP, ATTRIBUTE_ARIA_HIDDEN, ATTRIBUTE_ARIA_INVALID, ATTRIBUTE_ARIA_LABEL, ATTRIBUTE_ARIA_LABELDEBY, ATTRIBUTE_ARIA_LEVEL, ATTRIBUTE_ARIA_LIVE, ATTRIBUTE_ARIA_MULTISELECTABLE, ATTRIBUTE_ARIA_ORIENTATION, ATTRIBUTE_ARIA_OWNS, ATTRIBUTE_ARIA_POSINSET, ATTRIBUTE_ARIA_PRESSED, ATTRIBUTE_ARIA_READONLY, ATTRIBUTE_ARIA_RELEVANT, ATTRIBUTE_ARIA_REQUIRED, ATTRIBUTE_ARIA_SELECTED, ATTRIBUTE_ARIA_SETSIZE, ATTRIBUTE_ARIA_SORT, ATTRIBUTE_ARIA_VALUEMAX, ATTRIBUTE_ARIA_VALUEMIN, ATTRIBUTE_ARIA_VALUENOW, ATTRIBUTE_ARIA_VALUETEXT, ATTRIBUTE_WAI_ROLE, WAI_ROLE_ALERT, WAI_ROLE_ALERTDIALOG, WAI_ROLE_APPLICATION, WAI_ROLE_ARTICLE, WAI_ROLE_BANNER, WAI_ROLE_BUTTON, WAI_ROLE_CHECKBOX, WAI_ROLE_COLUMNHEADER, WAI_ROLE_COMBOBOX, WAI_ROLE_COMPLEMENTARY, WAI_ROLE_CONTENTINFO, WAI_ROLE_DEFINITION, WAI_ROLE_DIALOG, WAI_ROLE_DIRECTORY, WAI_ROLE_DOCUMENT, WAI_ROLE_FORM, WAI_ROLE_GRID, WAI_ROLE_GRIDCELL, WAI_ROLE_GROUP, WAI_ROLE_HEADING, WAI_ROLE_IMG, WAI_ROLE_LINK, WAI_ROLE_LIST, WAI_ROLE_LISTBOX, WAI_ROLE_LISTITEM, WAI_ROLE_LOG, WAI_ROLE_MAIN, WAI_ROLE_MARQUEE, WAI_ROLE_MATH, WAI_ROLE_MENU, WAI_ROLE_MENUBAR, WAI_ROLE_MENUITEM, WAI_ROLE_MENUITEMCHECKBOX, WAI_ROLE_MENUITEMRADIO, WAI_ROLE_NAVIGATION, WAI_ROLE_NOTE, WAI_ROLE_OPTION, WAI_ROLE_PRESENTATION, WAI_ROLE_PROGRESSBAR, WAI_ROLE_RADIO, WAI_ROLE_RADIOGROUP, WAI_ROLE_REGION, WAI_ROLE_ROW, WAI_ROLE_ROWGROUP, WAI_ROLE_ROWHEADER, WAI_ROLE_SCROLLBAR, WAI_ROLE_SEARCH, WAI_ROLE_SEPARATOR, WAI_ROLE_SLIDER, WAI_ROLE_SPINBUTTON, WAI_ROLE_STATUS, WAI_ROLE_TAB, WAI_ROLE_TABLIST, WAI_ROLE_TABPANEL, WAI_ROLE_TEXTBOX, WAI_ROLE_TIMER, WAI_ROLE_TOOLBAR, WAI_ROLE_TOOLTIP, WAI_ROLE_TREE, WAI_ROLE_TREEGRID, WAI_ROLE_TREEITEM
Constructor and Description |
---|
ComboBox(org.openqa.selenium.WebElement combobox) |
Modifier and Type | Method and Description |
---|---|
protected void |
castOperable()
Cast the IOperable object to the specific one.
The subclasses will override this method as they know what specific Operable to use. Here a void implementation is given, as not all subclass need the specific Operable, such as EditBox. Cast may throw Exception, we should catch it if calling this method. This method should be called after Component.anOperableObject has been initialized. |
protected IOperable |
createDOJOOperable()
Create the IOperable object for DOJO domain.
Subclass SHOULD override this method if DOJO will be supported. |
protected IOperable |
createHTMLOperable()
Create the IOperable object for HTML domain.
Subclass SHOULD override this method if HTML will be supported. |
protected IOperable |
createSAPOperable()
Create the IOperable object for SAP domain.
Subclass SHOULD override this method if SAP will be supported. |
java.util.List<java.lang.String> |
getDataList() |
boolean |
getForceRefresh() |
java.lang.Object |
getItem(int index) |
static java.util.List<java.lang.String> |
getSelectedOptions(ComboBox.Selectable select)
Get all the selected options from the combo box,
meanwhile it will CHECK that something has been selected in the combo box. |
void |
hidePopup() |
java.util.List<java.lang.String> |
select(java.lang.String item,
boolean verify,
boolean partialMatch,
boolean cleanSelectedItems)
Select the combo box by text.
First, try to check if the text exists in the combo box; if not found, a ComboBoxException will be thrown out with ComboBoxException.CODE_NO_MATCHING_ITEM .Then, try to select the text in the combo box. Finally, try to verify that the text has been selected; if not selected, a ComboBoxException will be thrown out with ComboBoxException.CODE_NOTHING_SELECTED or ComboBoxException.CODE_FAIL_VERIFICATION . |
java.util.List<java.lang.String> |
selectIndex(int index,
boolean verify,
boolean cleanSelectedItems)
Select the combo box by index.
First, try to check if the index is within the combo box; if not, a ComboBoxException will be thrown out with ComboBoxException.CODE_INDEX_OUTOF_RANGE .Then, try to select the index in the combo box. Finally, try to verify that the item of index has been selected; if not selected, a ComboBoxException will be thrown out with ComboBoxException.CODE_NOTHING_SELECTED or ComboBoxException.CODE_FAIL_VERIFICATION . |
void |
setForceRefresh(boolean forceRefresh) |
void |
showPopup() |
void |
testSelect() |
java.util.List<java.lang.String> |
verifySelected(java.lang.String item)
Verify that the item has been selected in the combo box, if not a
SeleniumPlusException will be thrown out with ComboBoxException.CODE_NOTHING_SELECTED or ComboBoxException.CODE_FAIL_VERIFICATION |
static java.util.List<java.lang.String> |
verifySelectedText(ComboBox.Selectable select,
java.lang.String item,
boolean partialMatch) |
clearCache, clearComponentBox, createDefaultOperable, createGenericOperable, createOperable, doubleCheckVerification, getDijitpopupparent, getMatchedElement, getValue, getWaiRole, getWidgetid, initialize, inputChars, inputComponentBoxChars, inputComponentBoxKeys, inputKeys, isAccessible, permitInvisible, setDijitpopupparent, setFocus, setWidgetid, updateFields, verifyComponentBox
getAttribute, getCssClass, getEmbeddedObject, getId, getMap, getPossibleRecognitionStrings, getSearchContext, getTagName, getWebElement, initialize, refresh, setCssClass, setId, setPossibleRecognitionStrings, setSearchContext, setTagName, setWebElement
public static final java.lang.String ITEM_SEPARATOR
public static final java.lang.String CLASS_HTML_SELECT
public static final java.lang.String CLASS_DOJO_COMBOBOX
public static final java.lang.String CLASS_DOJO_SELECT
public static final int DEFAULT_MAX_REFRESH_TIMES
public static int MAX_REFRESH_TIMES
ComboBox.Selectable select
public ComboBox(org.openqa.selenium.WebElement combobox) throws SeleniumPlusException
combobox
- WebElement combo box object, for example an HTML tag <select>.SeleniumPlusException
public boolean getForceRefresh()
public void setForceRefresh(boolean forceRefresh)
protected void castOperable()
Component
Component.anOperableObject
has been initialized.castOperable
in class Component
Component.anOperableObject
,
Component.updateFields()
protected IOperable createDOJOOperable()
Component
createDOJOOperable
in class Component
Component.createOperable(WebElement)
protected IOperable createSAPOperable()
Component
createSAPOperable
in class Component
Component.createOperable(WebElement)
protected IOperable createHTMLOperable()
Component
createHTMLOperable
in class Component
Component.createOperable(WebElement)
public java.util.List<java.lang.String> getDataList() throws SeleniumPlusException
SeleniumPlusException
public void hidePopup() throws SeleniumPlusException
SeleniumPlusException
public void showPopup() throws SeleniumPlusException
SeleniumPlusException
public java.util.List<java.lang.String> select(java.lang.String item, boolean verify, boolean partialMatch, boolean cleanSelectedItems) throws SeleniumPlusException
ComboBoxException
ComboBoxException.CODE_NO_MATCHING_ITEM
.ComboBoxException
ComboBoxException.CODE_NOTHING_SELECTED
or ComboBoxException.CODE_FAIL_VERIFICATION
.item
- String, the text item to select.verify
- boolean, if verification of the selected item is needed.partialMatch
- boolean, if the item is part of the option to select.cleanSelectedItems
- boolean, if true clean the selected items before selection.
this parameter take effect only if the combo box permit multiple selection.SeleniumPlusException
#checkComboBox(String)
,
#getSelectedOptions(HtmlSelect)
,
#verifySelectedText(HtmlSelect, String, boolean)
public java.util.List<java.lang.String> selectIndex(int index, boolean verify, boolean cleanSelectedItems) throws SeleniumPlusException
ComboBoxException
ComboBoxException.CODE_INDEX_OUTOF_RANGE
.ComboBoxException
ComboBoxException.CODE_NOTHING_SELECTED
or ComboBoxException.CODE_FAIL_VERIFICATION
.index
- int, the index of the option to select, 0 based.verify
- boolean, if verification of the selected item is needed.cleanSelectedItems
- boolean, clean the selected items before new selection if true.
this parameter take effect only if the combo box permit multiple selection. *SeleniumPlusException
#checkComboBox(String)
,
#getSelectedOptions(HtmlSelect)
public java.util.List<java.lang.String> verifySelected(java.lang.String item) throws SeleniumPlusException
SeleniumPlusException
will be ComboBoxException.CODE_NOTHING_SELECTED
or ComboBoxException.CODE_FAIL_VERIFICATION
item
- String the text excepted being selectedSeleniumPlusException
#checkComboBox(WebElement)
,
#verifySelectedText(HtmlSelect, String, boolean)
public java.lang.Object getItem(int index) throws SeleniumPlusException
SeleniumPlusException
public static java.util.List<java.lang.String> verifySelectedText(ComboBox.Selectable select, java.lang.String item, boolean partialMatch) throws SeleniumPlusException
select
- Select, the Select objectitem
- String, the text excepted being selectedpartialMatch
- boolean if true, item can be substring of the selected option.SeleniumPlusException
#getSelectedOptions(HtmlSelect)}
public static java.util.List<java.lang.String> getSelectedOptions(ComboBox.Selectable select) throws SeleniumPlusException
select
- Select the Selenium Select objectSeleniumPlusException
- will be thrown out with code ComboBoxException.CODE_NOTHING_SELECTED
if nothing has been selectedpublic void testSelect()
Copyright © SAS Institute. All Rights Reserved.