Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r2973400d6b1fd9c3eb3a585444a3df1d616d5a04 -r4b929ef6eef32479f10e84325b0ad12173474a4d --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 2973400d6b1fd9c3eb3a585444a3df1d616d5a04) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 4b929ef6eef32479f10e84325b0ad12173474a4d) @@ -126,7 +126,26 @@ found = findChildByText(child, target_text) if found: return found - + + return None + +def findAllObjectsById(parent, target_id): + """ + Recursively finds all child objects by their id property. + Returns a list of all matching objects found. + """ + results = [] + + # Use hasattr to safely check for 'id' property + if hasattr(parent, 'id') and str(parent.id) == target_id: + results.append(parent) + + # Recurse through all children to collect all instances + for child in object.children(parent): + results.extend(findAllObjectsById(child, target_id)) + + return results + def set_value_based_on_target(obj, target_value): """ obj: dictionary containing object paths @@ -248,6 +267,17 @@ utils.waitForGUI(0.2) # Small delay to allow UI to update return None + +def get_row_object(screen_obj, num): + """ + To obtain a row object based on occurrence provided. + @param screen_obj: provides the container on which the row must be present + @param num: provides the occurrence value (0-based index) + @returns a real name object + """ + names.o_Row_Object["container"] = screen_obj + names.o_Row_Object["occurrence"] = num + 1 + return names.o_Row_Object def get_object_color(names_dict, error_message = "Missing object color", timeout_ms = 2000): """ @@ -259,7 +289,6 @@ return squish.waitForObject(names_dict, timeout_ms).color.name except LookupError: test.fail("ERROR : " + error_message) - return None def get_object_source_path(names_dict, error_message = "Missing object source path", timeout_ms = 2000): @@ -270,9 +299,9 @@ """ try: return squish.waitForObject(names_dict, timeout_ms).source.path - except LookupError: - return None + except LookupError: test.fail("ERROR : " + error_message) + return None def get_object_text(names_dict, error_message = "Missing object text", timeout_ms = 2000): """