From c44a3076c0e836b4048b0a3a61576a64ae3a9467 Mon Sep 17 00:00:00 2001 From: LawyZheng Date: Thu, 27 Jun 2024 20:24:28 +0800 Subject: [PATCH] fix invisible svg bug (#525) --- skyvern/webeye/scraper/domUtils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js index c23f5ba7..74469c76 100644 --- a/skyvern/webeye/scraper/domUtils.js +++ b/skyvern/webeye/scraper/domUtils.js @@ -863,11 +863,12 @@ async function buildTreeFromBody(frame = "main.frame", open_select = false) { !isScriptOrStyle(element) ) { let elementObj = null; + let isParentSVG = element.closest("svg"); if (element.tagName.toLowerCase() === "svg") { // if element is we save all attributes and its children elementObj = await buildElementObject(element, false); - } else if (element.closest("svg")) { - // if elemnet is the children of + } else if (isParentSVG && isParentSVG.getAttribute("unique_id")) { + // if elemnet is the children of the with an unique_id elementObj = await buildElementObject(element, false); } else { // character length limit for non-interactable elements should be 5000