From 13d61c0eddb5285e42550798d806d1072fdbec40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Gonz=C3=A1lez=20Alonso?= Date: Thu, 21 Mar 2024 17:42:31 +0100 Subject: [PATCH] fix: ignore not found excluded elements in visual tests --- CHANGELOG.rst | 1 + toolium/visual_test.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) 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..8e774c68 100644 --- a/toolium/visual_test.py +++ b/toolium/visual_test.py @@ -105,8 +105,12 @@ 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) except NoSuchElementException as e: + exclude_web_element = None + if exclude_web_element: + exclude_web_elements.append(exclude_web_element) + else: self.logger.warning("Element to be excluded not found: %s", str(e)) baseline_path = os.path.join(self.baseline_directory, '{}.png'.format(filename))