def wrapped_function(*args, **kwargs): """The decorator function""" # Hold value of the original function context = function(*args, **kwargs) if not context: tc = init_test_case() tc.fail("Could not find {}".format(self.element_name)) # Go back to the caller, with the original response return context
def wrapped_function(*args, **kwargs): """The decorator function""" _driver = args[0]._driver # Hold value of the original function context = function(*args, **kwargs) try: WebDriverWait(_driver, 10).until(presence_of_element_located((By.ID, "Hyakuten"))) except TimeoutException: tc = init_test_case() tc.fail("Could not find the main title element, is the user on the main page?") # Go back to the caller, with the original response return context
def wrapped_function(*args, **kwargs): """The decorator function""" _driver = args[0]._driver try: wait = WebDriverWait(_driver, 10) wait.until(presence_of_element_located((By.ID, QUIZ_NOTE))) except TimeoutException: tc = init_test_case() tc.fail("Could not find the Quiz Label element, is the user on the Quiz?") # Hold value of the original function context = function(*args, **kwargs) # Go back to the caller, with the original response return context