Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
chore: replace script_mode print() with LOG.debug to cut log volume (SKY-9945) (#6030)
LawyZhengaf842b8667c3
diff --git a/skyvern/core/script_generations/real_skyvern_page_ai.py b/skyvern/core/script_generations/real_skyvern_page_ai.pyindex 3abb13fb1..ac143212f 100644--- a/skyvern/core/script_generations/real_skyvern_page_ai.py+++ b/skyvern/core/script_generations/real_skyvern_page_ai.py@@ -1271,17 +1271,7 @@ class RealSkyvernPageAi(SkyvernPageAi):LOG.warning("ai_extract cache store failed; ignoring", exc_info=True)if context and context.script_mode:- print(f"\nβ¨ π Extracted Information:\n{'-' * 50}")-- try:- # Pretty print JSON if result is a dict/list- if isinstance(result, (dict, list)):- print(json.dumps(result, indent=2, ensure_ascii=False))- else:- print(result)- except Exception:- print(result)- print(f"{'-' * 50}\n")+ LOG.debug("Extracted information", result=result)return resultasync def ai_validate(diff --git a/skyvern/core/script_generations/script_skyvern_page.py b/skyvern/core/script_generations/script_skyvern_page.pyindex a2d4c8059..18c4d8202 100644--- a/skyvern/core/script_generations/script_skyvern_page.py+++ b/skyvern/core/script_generations/script_skyvern_page.py@@ -180,22 +180,6 @@ class ScriptSkyvernPage(SkyvernPage):and screenshot artifacts after action execution."""- # Emoji mapping for different action types- ACTION_EMOJIS = {- ActionType.CLICK: "π",- ActionType.INPUT_TEXT: "β¨οΈ",- ActionType.UPLOAD_FILE: "π€",- ActionType.DOWNLOAD_FILE: "π₯",- ActionType.HOVER: "π±οΈ",- ActionType.SELECT_OPTION: "π―",- ActionType.WAIT: "β³",- ActionType.SOLVE_CAPTCHA: "π",- ActionType.VERIFICATION_CODE: "π",- ActionType.SCROLL: "π",- ActionType.COMPLETE: "β ",- ActionType.TERMINATE: "π",- }-prompt = kwargs.get("prompt", "")# Backward compatibility: use intention if provided and prompt is empty@@ -209,16 +193,10 @@ class ScriptSkyvernPage(SkyvernPage):action_status = ActionStatus.completed- # Print action in script modecontext = skyvern_context.current()if context and context.script_mode:- emoji = ACTION_EMOJIS.get(action, "π§")action_name = action.value if hasattr(action, "value") else str(action)- print(f"{emoji} {action_name.replace('_', ' ').title()}", end="")- if prompt:- print(f": {prompt}")- else:- print()+ LOG.debug("Script action", action=action_name, prompt=prompt)# Download detection for click actionsdownload_triggered: bool | None = None@@ -256,9 +234,8 @@ class ScriptSkyvernPage(SkyvernPage):# Note: Action status would be updated to completed here if update method existed- # Print success in script modeif context and context.script_mode:- print(" β Completed")+ LOG.debug("Action completed")return call.resultexcept Exception as e:@@ -966,7 +943,7 @@ class ScriptSkyvernPage(SkyvernPage):context = skyvern_context.current()is_script_mode = context and context.script_modeif is_script_mode:- print(f"π Navigating to: {url}")+ LOG.debug("Navigating to URL", url=url)timeout = kwargs.pop("timeout", settings.BROWSER_LOADING_TIMEOUT_MS)max_retries = kwargs.pop("max_retries", NAVIGATION_MAX_RETRY_TIME)@@ -977,7 +954,7 @@ class ScriptSkyvernPage(SkyvernPage):try:await self.page.goto(url, timeout=timeout, **kwargs)if is_script_mode:- print(" β Page loaded")+ LOG.debug("Page loaded")returnexcept Exception as e:last_error = e@@ -1037,7 +1014,7 @@ class ScriptSkyvernPage(SkyvernPage):returnif context.skip_complete_verification:if context.script_mode:- print(" β Skipping complete() verification (--no-verify)")+ LOG.debug("Skipping complete() verification (--no-verify)")return# In script mode, add a settle delay before verification. Scripts execute