Package core.helpers
Class ListHelper
java.lang.Object
core.helpers.ListHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetElementIndexContainByText(EnhancedBy list, String option) returns index of element in list which contains in textintgetElementIndexEqualsByText(EnhancedBy list, String option) returns the index of text value in a list normalizes the list option When comparing using Helper.stringNormalize() returns first visible element indexintgetElementIndexEqualsByTextWithoutRetry(EnhancedBy list, String option) intgetElementIndexInList(EnhancedBy list, EnhancedBy target) find the index of the target element in list eg.intgetListCount(EnhancedBy list) returns the number of elements in listgetListValues(EnhancedBy list) returns the list of values in a listgetRowValuesFromList(EnhancedBy list, int index, EnhancedBy cells) returns the list of string values for a row of elementsintgetStringIndexContainByText(EnhancedBy list, List<String> stringList, String option) returns the index of string value in list of stringsintgetStringIndexContainByText(List<String> stringList, String option) returns the index of string value in list of stringsintgetStringIndexEqualsByText(EnhancedBy list, List<String> stringList, String option) returns the index of string value in list of stringsintgetStringIndexEqualsByText(List<String> stringList, String option) returns the index of string value in list of stringsgetTableMap(EnhancedBy columns, int columnInitialIndex, EnhancedBy dataRows, int rowInitialIndex, EnhancedBy dataCells, int maxRows) gets hashmap representation of data column with row valuesgetTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells) gets hashmap representation of data column with row valuesgetTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells, int maxRows) gets hashmap representation of data column with row valuesgetTableRowValues(EnhancedBy dataRows, EnhancedBy dataCells) gets hashmap of table rows map will return row index and row values as arraylistgetTableRowValues(EnhancedBy dataRows, EnhancedBy dataCells, int maxRows) gets hashmap of table rows map will return row index and row values as arraylistgetTextList(EnhancedBy list) get list of text valuesintgetVisibleElementIndex(EnhancedBy list, List<Integer> indexValues) booleanisContainedInList(EnhancedBy list, String option) return if element is contained in listbooleanisExactMatchInList(EnhancedBy list, String option) return if element is an exact match in listvoidsearchAndWaitForResults(String searchQuery, EnhancedBy byTarget, EnhancedBy spinner) enters value into the search field And selects enter waits for the loading spinner to be removedvoidselectElementContainedInList(EnhancedBy list, String option, EnhancedBy target) Selects list item from a parent container eg.voidselectElementContainedInList(EnhancedBy list, String option, EnhancedBy target, int targetIndex) Selects list item from a parent container eg.voidselectElementInList(EnhancedBy list, int index) selects an element in list by its index valuevoidselectElementInList(EnhancedBy list, int index, EnhancedBy expected) selects an element in list by its index value And waits for expected elementvoidselectListItemByIndex(EnhancedBy list, int index) selects list item by the string option providedvoidselectListItemContainsByName(EnhancedBy list, String option) finds target element which is in the same container And has the same index as the parent eg.voidselectListItemContainsByName(EnhancedBy list, String option, EnhancedBy target) selects list item containing string eg.voidselectListItemEqualsByName(EnhancedBy list, String option) selects list item by the string option providedvoidselectListItemEqualsByName(EnhancedBy list, String option, EnhancedBy target) finds target element which is in the same container And has the same index as the parent eg.voidverifyContainsIsInList(EnhancedBy list, String option) verifies if option value is in the list index = -1 indicates the value is not in listvoidverifyIsInList(EnhancedBy list, String option) verifies if option value is in the list index = -1 indicates the value is not in listvoidverifyIsInList(EnhancedBy list, String indicator, String option) verify text option in list based on key value in the list
-
Constructor Details
-
ListHelper
public ListHelper()
-
-
Method Details
-
selectElementInList
selects an element in list by its index value- Parameters:
list-index-
-
selectElementInList
selects an element in list by its index value And waits for expected element- Parameters:
list-index-expected-
-
searchAndWaitForResults
enters value into the search field And selects enter waits for the loading spinner to be removed- Parameters:
searchQuery-byTarget-spinner-
-
selectListItemEqualsByName
selects list item by the string option provided- Parameters:
list-option-
-
selectListItemEqualsByName
finds target element which is in the same container And has the same index as the parent eg. delete button in the list of customers, both having index 2. we find the index by name, And use that to find the target element- Parameters:
list-option-target-
-
selectListItemContainsByName
selects list item containing string eg. a list of athletes names containing a delete button- Parameters:
list-option-target-
-
selectElementContainedInList
Selects list item from a parent container eg. delete button in a list defined by name find the container containing the name And Then finds the delete button in that container as target- Parameters:
list-option- selectListItemContainsFromContainertarget-
-
selectElementContainedInList
public void selectElementContainedInList(EnhancedBy list, String option, EnhancedBy target, int targetIndex) Selects list item from a parent container eg. delete button in a list defined by name find the container containing the name And Then finds the delete button in that container as target- Parameters:
list-option- selectListItemContainsFromContainertarget-
-
getElementIndexInList
find the index of the target element in list eg. list A, 5 rows, has element B in row 2. therefore, index 1 is returned @param list- Parameters:
list-target-- Returns:
- index of element in list
-
getRowValuesFromList
returns the list of string values for a row of elements- Parameters:
list-index-cells-- Returns:
-
getTableMap
public HashMap<String,List<String>> getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells) gets hashmap representation of data column with row values- Parameters:
columns-dataRows-- Returns:
-
getTableMap
public HashMap<String,List<String>> getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells, int maxRows) gets hashmap representation of data column with row values- Parameters:
columns-dataRows-dataCells-maxRows-- Returns:
-
getTableMap
public HashMap<String,List<String>> getTableMap(EnhancedBy columns, int columnInitialIndex, EnhancedBy dataRows, int rowInitialIndex, EnhancedBy dataCells, int maxRows) gets hashmap representation of data column with row values- Parameters:
columns-columnInitialIndex-dataRows-rowInitialIndex-dataCells-maxRows-- Returns:
-
getTableRowValues
gets hashmap of table rows map will return row index and row values as arraylist- Parameters:
dataRows-dataCells-- Returns:
-
getTableRowValues
public HashMap<Integer,List<String>> getTableRowValues(EnhancedBy dataRows, EnhancedBy dataCells, int maxRows) gets hashmap of table rows map will return row index and row values as arraylist- Parameters:
dataRows-dataCells-maxRows-- Returns:
-
selectListItemContainsByName
finds target element which is in the same container And has the same index as the parent eg. delete button in the list of customers, both having index 2. we find the index containing name, And use that to find the target element- Parameters:
list-option-
-
selectListItemByIndex
selects list item by the string option provided- Parameters:
list-option-
-
getListCount
returns the number of elements in list- Parameters:
list-- Returns:
-
getElementIndexEqualsByTextWithoutRetry
-
getElementIndexEqualsByText
returns the index of text value in a list normalizes the list option When comparing using Helper.stringNormalize() returns first visible element index- Parameters:
list-option-- Returns:
-
getElementIndexContainByText
returns index of element in list which contains in text- Parameters:
list-option-- Returns:
-
getVisibleElementIndex
-
getStringIndexContainByText
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
getStringIndexContainByText
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
getStringIndexEqualsByText
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
getStringIndexEqualsByText
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
verifyContainsIsInList
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
verify text option in list based on key value in the list- Parameters:
list-indicator-option-
-
isContainedInList
return if element is contained in list- Parameters:
list-option-- Returns:
-
isExactMatchInList
return if element is an exact match in list- Parameters:
list-option-- Returns:
-
getListValues
returns the list of values in a list- Parameters:
list-- Returns:
-
getTextList
get list of text values- Parameters:
list-- Returns:
-