@@ -752,37 +752,20 @@ async def take_screenshot(
752752 screenshot_path : Optional [str ] = None
753753 ) -> None :
754754 """
755- Capture a full-page screenshot and optionally save it to disk.
756-
755+ Capture a full-page screenshot and save it to disk.
756+
757757 Args:
758758 page: The Playwright Page to screenshot. Defaults to instance page.
759759 screenshot_path: Custom path for the screenshot. Auto-generated if None.
760-
761- Note:
762- Screenshot saving is controlled by ActionHandler._save_screenshots.
763- If saving is disabled, this method still captures the screenshot but
764- doesn't save it to disk (Playwright path=None behavior).
765760 """
766761 if page is None :
767762 page = self .page
768763
769- # Import here to avoid circular dependency
770- from webqa_agent .actions .action_handler import ActionHandler
771-
772- # Only prepare path if saving is enabled
773- path_str = None
774- if ActionHandler ._save_screenshots :
775- if screenshot_path :
776- path = Path (screenshot_path )
777- else :
778- path = self .SCREENSHOTS_DIR / f"{ get_time ()} _marker.png"
779-
780- path .parent .mkdir (parents = True , exist_ok = True )
781- path_str = str (path )
782-
783- await page .screenshot (path = path_str , full_page = True )
784-
785- if path_str :
786- logging .debug (f"Screenshot saved to { path_str } " )
764+ if screenshot_path :
765+ path = Path (screenshot_path )
787766 else :
788- logging .debug ("Screenshot captured (not saved to disk)" )
767+ path = self .SCREENSHOTS_DIR / f"{ get_time ()} _marker.png"
768+
769+ path .parent .mkdir (parents = True , exist_ok = True )
770+ await page .screenshot (path = str (path ), full_page = True )
771+ logging .debug (f"Screenshot saved to { path } " )
0 commit comments