From 4e179690bfe3862e6474bd77dc53671fd3a49902 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 2 Jul 2024 11:19:36 +0100 Subject: [PATCH] Fix screenshots] --- helpers/playwrightHelper.py | 3 +-- pages/login_page.py | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/helpers/playwrightHelper.py b/helpers/playwrightHelper.py index 4ec11a7eb..8727dd802 100644 --- a/helpers/playwrightHelper.py +++ b/helpers/playwrightHelper.py @@ -81,11 +81,10 @@ def launch_mobile_browser(self, device_name, headless_mode): def capture_screenshot(self, filename): screenshot_path = os.path.join(self.screenshots_dir, f'before_action_{filename}.png') try: - self.page.screenshot(path=screenshot_path, timeout=3000) + self.page.screenshot(path=screenshot_path) except Exception as error: if "Timeout" in str(error): print('Screenshot taking timed out, ignoring...') - self.page.screenshot(path=screenshot_path) return None else: raise error diff --git a/pages/login_page.py b/pages/login_page.py index 905eaec4e..0c0d690e2 100644 --- a/pages/login_page.py +++ b/pages/login_page.py @@ -1,9 +1,13 @@ from init_helpers import * LOGIN_BUTTON_ELEMENT = ("//button[text()='Log In']") +ACCEPT_COOKIES_ELEMENT = ("#nhsuk-cookie-banner__link_accept_analytics") def navigate_to_ravs_login_page(url): navigate_to_url(url) + wait_for_element_to_appear(ACCEPT_COOKIES_ELEMENT) + if check_element_exists(ACCEPT_COOKIES_ELEMENT): + find_element_and_perform_action(ACCEPT_COOKIES_ELEMENT, "click") wait_for_page_to_load() def check_login_button_exists():