Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rbddd2fe08aac52e286b53a811f0ab41919c7fea2 -rd94d75c2c397752dfee66870ad4cee7dd913651d --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision bddd2fe08aac52e286b53a811f0ab41919c7fea2) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision d94d75c2c397752dfee66870ad4cee7dd913651d) @@ -171,3 +171,40 @@ squish.mouseClick(waitForObject(left_arrow)) utils.waitForGUI(0.2) # Small delay to allow UI to update + return None + +def get_object_color(names_dict, error_message = "Missing object color", timeout_ms = 2000): + """ + To get an object color 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) + @returns the object with corresponding dictionary, otherwise "None" + """ + try: + 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): + """ + To get an object source path 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) + @returns the object with corresponding dictionary, otherwise "None" + """ + try: + return squish.waitForObject(names_dict, timeout_ms).source.path + except LookupError: + test.fail("ERROR : " + error_message) + return None + +def get_object_text(names_dict, error_message = "Missing object text", timeout_ms = 2000): + """ + To get an object text string 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) + @returns the object with corresponding dictionary, otherwise "None" + """ + try: + return squish.waitForObject(names_dict, timeout_ms).text + except LookupError: + test.fail("ERROR : " + error_message) + return None