diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0ed8dd2d..19936a57 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,7 @@ v3.1.4 - Add `ignore_empty` optional parameter to POEditor configuration to ignore empty translations - Fix on swipe method. Duration from None to 0. +- Ignore not found excluded elements in visual tests v3.1.3 ------ diff --git a/toolium/visual_test.py b/toolium/visual_test.py index 55bdb4a2..3859c366 100644 --- a/toolium/visual_test.py +++ b/toolium/visual_test.py @@ -105,9 +105,13 @@ def assert_screenshot(self, element, filename, file_suffix=None, threshold=0, ex exclude_web_elements = [] for exclude_element in exclude_elements: try: - exclude_web_elements.append(self.utils.get_web_element(exclude_element)) + exclude_web_element = self.utils.get_web_element(exclude_element) + if exclude_web_element: + exclude_web_elements.append(exclude_web_element) + else: + self.logger.warning('Element to be excluded not found') except NoSuchElementException as e: - self.logger.warning("Element to be excluded not found: %s", str(e)) + self.logger.warning(f'Element to be excluded not found: {str(e)}') baseline_path = os.path.join(self.baseline_directory, '{}.png'.format(filename)) filename_with_suffix = '{0}__{1}'.format(filename, file_suffix) if file_suffix else filename