Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r8f9df8e70510cbd35fcefa54812b16bf0ee0e3ff -r733e6e27c1d88e9615ab0d2ac422d8e5d87de89e --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 8f9df8e70510cbd35fcefa54812b16bf0ee0e3ff) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 733e6e27c1d88e9615ab0d2ac422d8e5d87de89e) @@ -3,12 +3,12 @@ import object import names from leahi_dialin.ui.td_messaging import TD_Messaging -from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates -from configuration import config, navigation +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from configuration import config, navigation +from leahi_dialin.ui import utils +from builtins import int as pyInt td =TD_Messaging() -from leahi_dialin.ui import utils -from builtins import int as pyInt def aut(*args): """ @@ -18,7 +18,7 @@ return " ".join(('leahi', *args)) -def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): +def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 3000): """ To get an object with try..except catching to prevent script errors when the object is not found on the GUI @param names_dict - the dictionary element from the names.py file (ie: names.some_variable_name_of_element) @@ -51,7 +51,7 @@ names.o_text_object["text"] = txt return names.o_text_object -def setObjectText(text,obj): +def setObjectText(obj,text): """ Method to set object property based on text @param text : (string) treatment parameter text @@ -259,6 +259,7 @@ test.fail("ERROR : " + error_message) return None + def get_object_source_path(names_dict, error_message = "Missing object source path", timeout_ms = 2000): """ To get an object source path with try..except catching to prevent script errors when the object is not found on the GUI @@ -281,16 +282,19 @@ return squish.waitForObject(names_dict, timeout_ms).text except LookupError: test.fail("ERROR : " + error_message) - return None + return None + + results.append(parent) + def findAllObjectsByText(parent, target_text): """ Recursively finds all child objects that have a 'text' property - """ matching the target_text. Returns a list of matches. + """ results = [] # Use hasattr to safely check for 'text' property before comparing - results.append(parent) if hasattr(parent, 'text') and str(parent.text) == target_text: + results.append(parent) # Recurse through all children for child in object.children(parent):