Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r7fa3503b0eeaf8e05f4f885d7af4ea2947d90e0a -r1097bc6de60f08ded2041552ccf66eff85020625 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 7fa3503b0eeaf8e05f4f885d7af4ea2947d90e0a) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 1097bc6de60f08ded2041552ccf66eff85020625) @@ -457,3 +457,16 @@ results.extend(findAllObjectsById(child, target_id)) return results + +def get_object_value(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: + object_value = squish.waitForObject(names_dict, timeout_ms).value + return str(object_value) + except LookupError: + test.fail("ERROR : " + error_message) + return None