Skip to main content

DropDownActions

Static methods​

onDropDown​

This will return IDropDownActions which will expose different methods to handle drop down actions.

IDropDownActions dropDownActions = DropDownActions.onDropDown ();

Instance methods​

deselectAll​

This method will deselect all the options of the given multi-select element.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (multiSelectLocator).deselectAll ();

deselectByIndex (index)​

This method will deselect the option of the given dropdown / multi-select element by the given index.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).deselectByIndex (1);

deselectByText (text)​

This method will deselect the option of the given dropdown / multi-select element by the given text.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).deselectByText ("Option 1");

deselectByValue (value)​

This method will deselect the option of the given dropdown / multi-select element by the given value.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).deselectByValue ("val1");

selectByIndex (index)​

This method will select the option of the given dropdown / multi-select element by the given index.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).selectByIndex (2);

selectByText (text)​

This method will select the option of the given dropdown / multi-select element by the given text.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).selectByText ("Option 2");

selectByValue (value)​

This method will select the option of the given dropdown / multi-select element by the given value.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).selectByValue ("value-2");

selectedItem​

This method will return the selected item text of the given dropdown / multi-select element.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
String itemText = onDropDown (dropdownLocator).selectedItem ();

selectedItems​

This method will return the list of selected item texts of the given multi-select element.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
List<String> itemTexts = onDropDown (dropdownLocator).selectedItems (dropdownLocator);

verifySelectedItem​

This method will verify the selected item from the drop down.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).verifySelectedItem ().isEqualTo ("Batman");

verifySelectedItems​

This method will verify the list of selected items from the drop down.

import static io.github.boykaframework.actions.elements.DropDownActions.onDropDown;
. . .
onDropDown (dropdownLocator).verifySelectedItems ().containsExactly ("The Avengers", "Batman", "Black Panther");