Skip to content

Automate browser based workflows with AI

DomUtil optimize (#350)

LawyZhengf86097fc7831
diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.js
index 59ab78158..c5b8f76a2 100644
--- a/skyvern/webeye/scraper/domUtils.js
+++ b/skyvern/webeye/scraper/domUtils.js
@@ -758,8 +758,10 @@ function buildTreeFromBody() {
}
}
- // character length limit for non-interactable elements should be 100
- if (textContent && textContent.length <= 100) {
+ // character length limit for non-interactable elements should be 5000
+ // we don't use element context in HTML format,
+ // so we need to make sure we parse all text node to avoid missing text in HTML.
+ if (textContent && textContent.length <= 5000) {
var elementObj = buildElementObject(element, false);
elements.push(elementObj);
if (parentId === null) {
@@ -991,7 +993,8 @@ function buildTreeFromBody() {
element.context = context;
}
- if (checkStringIncludeRequire(context)) {
+ // FIXME: skip <a> for now to prevent navigating to other page by mistake
+ if (element.tagName !== "a" && checkStringIncludeRequire(context)) {
if (
!element.attributes["required"] &&
!element.attributes["aria-required"]