import squish import test from datetime import datetime 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_current_date_and_time(date_format='%Y/%b/%d - %H:%M'): date = datetime.now() return str(date.strftime(date_format)) def vitals_reading_obj(reading): names.o_vitals_reading["text"] = reading return names.o_vitals_reading