Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r8bfb02b2b8e50dccd822549c11d340df033744c7 -rdc699ba85fda9e7196a496a1b5ee79a3ea248be1 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 8bfb02b2b8e50dccd822549c11d340df033744c7) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision dc699ba85fda9e7196a496a1b5ee79a3ea248be1) @@ -364,3 +364,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