Package core.helpers
Class ListHelper
- java.lang.Object
-
- core.helpers.ListHelper
-
public class ListHelper extends Object
-
-
Constructor Summary
Constructors Constructor Description ListHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetElementIndexContainByText(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 indexintgetElementIndexInList(EnhancedBy list, EnhancedBy target)find the index of the target element in list eg.intgetListCount(EnhancedBy list)returns the number of elements in listList<String>getListValues(EnhancedBy list)returns the list of values in a listList<String>getRowValuesFromList(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 stringsHashMap<String,List<String>>getTableMap(EnhancedBy columns, int columnInitialIndex, EnhancedBy dataRows, int rowInitialIndex, EnhancedBy dataCells, int maxRows)gets hashmap representation of data column with row valuesHashMap<String,List<String>>getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells)gets hashmap representation of data column with row valuesHashMap<String,List<String>>getTableMap(EnhancedBy columns, EnhancedBy dataRows, EnhancedBy dataCells, int maxRows)gets hashmap representation of data column with row valuesHashMap<Integer,List<String>>getTableRowValues(EnhancedBy dataRows, EnhancedBy dataCells)gets hashmap of table rows map will return row index and row values as arraylistHashMap<Integer,List<String>>getTableRowValues(EnhancedBy dataRows, EnhancedBy dataCells, int maxRows)gets hashmap of table rows map will return row index and row values as arraylistList<String>getTextList(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
-
-
-
Method Detail
-
selectElementInList
public void selectElementInList(EnhancedBy list, int index)
selects an element in list by its index value- Parameters:
list-index-
-
selectElementInList
public void selectElementInList(EnhancedBy list, int index, EnhancedBy expected)
selects an element in list by its index value And waits for expected element- Parameters:
list-index-expected-
-
searchAndWaitForResults
public void searchAndWaitForResults(String searchQuery, EnhancedBy byTarget, EnhancedBy spinner)
enters value into the search field And selects enter waits for the loading spinner to be removed- Parameters:
searchQuery-byTarget-spinner-
-
selectListItemEqualsByName
public void selectListItemEqualsByName(EnhancedBy list, String option)
selects list item by the string option provided- Parameters:
list-option-
-
selectListItemEqualsByName
public void selectListItemEqualsByName(EnhancedBy list, String option, EnhancedBy target)
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
public void selectListItemContainsByName(EnhancedBy list, String option, EnhancedBy target)
selects list item containing string eg. a list of athletes names containing a delete button- Parameters:
list-option-target-
-
selectElementContainedInList
public void selectElementContainedInList(EnhancedBy list, String option, EnhancedBy target)
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
public int getElementIndexInList(EnhancedBy list, EnhancedBy target)
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
public List<String> getRowValuesFromList(EnhancedBy list, int index, EnhancedBy cells)
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
public HashMap<Integer,List<String>> getTableRowValues(EnhancedBy dataRows, EnhancedBy dataCells)
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
public void selectListItemContainsByName(EnhancedBy list, String option)
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
public void selectListItemByIndex(EnhancedBy list, int index)
selects list item by the string option provided- Parameters:
list-option-
-
getListCount
public int getListCount(EnhancedBy list)
returns the number of elements in list- Parameters:
list-- Returns:
-
getElementIndexEqualsByText
public int getElementIndexEqualsByText(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 index- Parameters:
list-option-- Returns:
-
getElementIndexContainByText
public int getElementIndexContainByText(EnhancedBy list, String option)
returns index of element in list which contains in text- Parameters:
list-option-- Returns:
-
getVisibleElementIndex
public int getVisibleElementIndex(EnhancedBy list, List<Integer> indexValues)
-
getStringIndexContainByText
public int getStringIndexContainByText(EnhancedBy list, List<String> stringList, String option)
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
getStringIndexContainByText
public int getStringIndexContainByText(List<String> stringList, String option)
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
getStringIndexEqualsByText
public int getStringIndexEqualsByText(EnhancedBy list, List<String> stringList, String option)
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
getStringIndexEqualsByText
public int getStringIndexEqualsByText(List<String> stringList, String option)
returns the index of string value in list of strings- Parameters:
stringList- normalizedoption- normalized- Returns:
-
verifyContainsIsInList
public void verifyContainsIsInList(EnhancedBy list, String option)
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
public void verifyIsInList(EnhancedBy list, String option)
verifies if option value is in the list index = -1 indicates the value is not in list- Parameters:
list-option-
-
verifyIsInList
public void verifyIsInList(EnhancedBy list, String indicator, String option)
verify text option in list based on key value in the list- Parameters:
list-indicator-option-
-
isContainedInList
public boolean isContainedInList(EnhancedBy list, String option)
return if element is contained in list- Parameters:
list-option-- Returns:
-
isExactMatchInList
public boolean isExactMatchInList(EnhancedBy list, String option)
return if element is an exact match in list- Parameters:
list-option-- Returns:
-
getListValues
public List<String> getListValues(EnhancedBy list)
returns the list of values in a list- Parameters:
list-- Returns:
-
getTextList
public List<String> getTextList(EnhancedBy list)
get list of text values- Parameters:
list-- Returns:
-
-