From 5de4ddd377758bdcb7bd83bc346e75bd48efb504 Mon Sep 17 00:00:00 2001 From: mdshakib007 Date: Wed, 1 Jul 2026 15:46:02 +0600 Subject: [PATCH] Fix TakeScreenShot function to silently skip pre-action captures when no driver is available --- Framework/Utilities/CommonUtil.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Framework/Utilities/CommonUtil.py b/Framework/Utilities/CommonUtil.py index 9ffd93e1..b106b765 100644 --- a/Framework/Utilities/CommonUtil.py +++ b/Framework/Utilities/CommonUtil.py @@ -880,6 +880,14 @@ def TakeScreenShot(function_name, local_run=False, pre_action=False): Method = screen_capture_type Driver = screen_capture_driver + # The driver for web/mobile may not exist yet when the BEFORE frame is requested + # (e.g. Go_To_Link launches the browser, so no selenium_driver exists until the + # action runs). A missing driver for a pre-action capture is expected, not an + # error, so skip it silently instead of announcing the capture and then logging a + # level-3 error from Thread_ScreenShot. + if pre_action and Method in ("mobile", "web") and Driver is None: + return + # Decide if screenshot should be captured if ( take_screenshot_settings.lower() == "false"