From 704dbd55d6edd8072a69724723aa40313884ea0d Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Wed, 16 Apr 2025 02:03:49 -0700 Subject: [PATCH] try to fix screenshot timeout (#2164) --- skyvern/forge/agent_functions.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/skyvern/forge/agent_functions.py b/skyvern/forge/agent_functions.py index 58bbc471..160c089e 100644 --- a/skyvern/forge/agent_functions.py +++ b/skyvern/forge/agent_functions.py @@ -318,8 +318,22 @@ async def _convert_css_shape_to_string( ) return None + try: + await locater.scroll_into_view_if_needed(timeout=settings.BROWSER_ACTION_TIMEOUT_MS) + await locater.wait_for(state="visible", timeout=settings.BROWSER_ACTION_TIMEOUT_MS) + except Exception: + LOG.info( + "Failed to make the element visible, going to abort conversion", + exc_info=True, + task_id=task_id, + step_id=step_id, + element_id=element_id, + key=shape_key, + ) + return None + LOG.debug("call LLM to convert css shape to string shape", element_id=element_id) - screenshot = await locater.screenshot(timeout=settings.BROWSER_ACTION_TIMEOUT_MS) + screenshot = await locater.screenshot(timeout=settings.BROWSER_ACTION_TIMEOUT_MS, animations="disabled") prompt = prompt_engine.load_prompt("css-shape-convert") # TODO: we don't retry the css shape conversion today