From 82249ae7f0608de021bea7ea58eb201e52adcd41 Mon Sep 17 00:00:00 2001 From: LawyZheng Date: Mon, 4 Nov 2024 16:07:52 +0800 Subject: [PATCH] skip css conversion for span with chidren (#1123) --- skyvern/forge/agent_functions.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/skyvern/forge/agent_functions.py b/skyvern/forge/agent_functions.py index ae577e0d..77d24cf5 100644 --- a/skyvern/forge/agent_functions.py +++ b/skyvern/forge/agent_functions.py @@ -36,19 +36,21 @@ def _should_css_shape_convert(element: Dict) -> bool: if tag_name not in ["a", "span", "i"]: return False - # if and without any text in the element, we try to convert the shape - if tag_name in ["span", "i"] and not element.get("text"): + # should be without children + if len(element.get("children", [])) > 0: + return False + + # should be no text + if element.get("text"): + return False + + # if and we try to convert the shape + if tag_name in ["span", "i"]: return True - # if , it should be no text, no children, no href/target attribute + # if , it should be no text, no href/target attribute if tag_name == "a": attributes = element.get("attributes", {}) - if element.get("text"): - return False - - if len(element.get("children", [])) > 0: - return False - if "href" in attributes: return False