Skip to content

ComboBox

Taisiia-Kozlova edited this page Nov 7, 2017 · 3 revisions

ComboBox is a typical element of a user interface that enables users to choose one of several options. It may contain a combination of controls, such as sliders, text boxes, and drop-down lists. Its distinctive feature is presence of text-fields, usually above dropdowns, where users may manually input options kept in dropdowns.

Example:

ComboBox

Here is the list of available methods.

Method Description Return Type
select(TEnum) , select(String) , select(int) Select element with name (use enum/text/index) from list void
getOptions() , getNames() , getValues() Get labels of all options List
getOptionsAsText() Get all options labels in one string separated with “; ” String
getSelected() Get name of the selected element String
getSelectedIndex() Get index of the selected element Int
**isSelected(TEnum) , isSelected(String) ** Is option (from enum/text/int) selected? boolean
waitSelected(TEnum) , waitSelected(String) Wait while option (from enum/text/int) selected. Returns false if this not happens boolean
SetValue; HaveValue; See methods by link

Initialization of ComboBox:

public IComboBox <T> comboBox = new ComboBox<T>(//locators of textField and dropDownList);
	@Override
	protected String getTextAction () {
              return new Text(//locator of dropDownList).getText();
	}
};

Action > Examples:

@Test
public void getAllOptionsNames() {
    String option = “String value“;
    comboBox.textField.sendKeys(option);
    Assert.assertTrue(comboBox.isSelected(option), true);
}

See more examples on GitHub

Clone this wiki locally