Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Move a tag href target rewriting to the core loop to prevent new tabs from being opened (#475)
Kerem Yilmaz536736a7bf4e
diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.jsindex 2fdf76319..1dc227afa 100644--- a/skyvern/webeye/scraper/domUtils.js+++ b/skyvern/webeye/scraper/domUtils.js@@ -665,13 +665,7 @@ function buildTreeFromBody(frame = "main.frame") {var element_id = element.getAttribute("unique_id") ?? uniqueId();var elementTagNameLower = element.tagName.toLowerCase();element.setAttribute("unique_id", element_id);- // if element is an "a" tag and has a target="_blank" attribute, remove the target attribute- // We're doing this so that skyvern can do all the navigation in a single page/tab and not open new tab- if (element.tagName.toLowerCase() === "a") {- if (element.getAttribute("target") === "_blank") {- element.removeAttribute("target");- }- }+const attrs = {};for (const attr of element.attributes) {var attrValue = attr.value;@@ -762,6 +756,14 @@ function buildTreeFromBody(frame = "main.frame") {return;}+ // if element is an "a" tag and has a target="_blank" attribute, remove the target attribute+ // We're doing this so that skyvern can do all the navigation in a single page/tab and not open new tab+ if (element.tagName.toLowerCase() === "a") {+ if (element.getAttribute("target") === "_blank") {+ element.removeAttribute("target");+ }+ }+// Check if the element is interactableif (isInteractable(element)) {var elementObj = buildElementObject(element, true);