Skip to content

Commit 06f6826

Browse files
minor update
1 parent ca2a84b commit 06f6826

File tree

2 files changed

+10
-27
lines changed

2 files changed

+10
-27
lines changed

app_gradio/demo_gradio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def create_config_dict(
202202
"headless": True,
203203
"language": "zh-CN",
204204
"cookies": [],
205-
"save_screenshots": False # Always save screenshots in Gradio demo
205+
"save_screenshots": False # Always not save screenshots in Gradio demo
206206
}
207207
}
208208

webqa_agent/crawler/deep_crawler.py

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)