Index: shared/scripts/configuration/utility.py =================================================================== diff -u -re8535a7e3c30daad306221dd3d0c822f6994d503 -r9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68 --- shared/scripts/configuration/utility.py (.../utility.py) (revision e8535a7e3c30daad306221dd3d0c822f6994d503) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 9cb75f8b54e08f5f0ca42befd3c35ae5aea84c68) @@ -32,6 +32,17 @@ def color_verification(exp_val = "Red", act_val = "#c53b33"): test.compare(config.COLOR_CODES[color_name],(act_val.color[name])) +def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): + """ + 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) + @returns the object with corresponding dictionary, otherwise "None" + """ + try: + return squish.waitForObject(names_dict, timeout_ms) + except LookupError: + test.fail("ERROR : " + error_message) + return None def get_text_object(screen_obj, txt): """