stop removing target attr when scraping (#2495)

This commit is contained in:
Shuchang Zheng
2025-05-28 00:55:01 -07:00
committed by GitHub
parent 91a666f705
commit 31d6dbdacd
4 changed files with 14 additions and 13 deletions

View File

@@ -1378,15 +1378,6 @@ async function buildElementObject(
isSelect2MultiChoice(element),
};
// if element is an "a" tag and has a target="_blank" attribute, remove the target attribute but keep it in the elementObj
// We're doing this so that skyvern can do all the navigation in a single page/tab and not open new tab
if (elementTagNameLower === "a") {
if (element.getAttribute("target") === "_blank") {
elementObj.target = "_blank";
element.removeAttribute("target");
}
}
let isInShadowRoot = element.getRootNode() instanceof ShadowRoot;
if (isInShadowRoot) {
let shadowHostEle = element.getRootNode().host;

View File

@@ -869,9 +869,6 @@ def trim_element(element: dict) -> dict:
if "afterPseudoText" in queue_ele and not queue_ele.get("afterPseudoText"):
del queue_ele["afterPseudoText"]
if "target" in queue_ele:
del queue_ele["target"]
return element