Decorate bounding boxes with element_ids to improve Skyvern accuracy (+ a few more changes) (#536)

This commit is contained in:
Kerem Yilmaz
2024-07-01 21:24:52 -07:00
committed by GitHub
parent eb7478a58a
commit 257ba1601e
7 changed files with 59 additions and 22 deletions

View File

@@ -476,6 +476,7 @@ def trim_element_tree(elements: list[dict]) -> list[dict]:
def _trimmed_attributes(tag_name: str, attributes: dict) -> dict:
new_attributes: dict = {}
for key in attributes:
if key == "id" and tag_name in ["input", "textarea", "select"]:
# We don't want to remove the id attribute any of these elements in case there's a label for it
@@ -484,6 +485,7 @@ def _trimmed_attributes(tag_name: str, attributes: dict) -> dict:
new_attributes[key] = attributes[key]
if key in RESERVED_ATTRIBUTES and attributes[key]:
new_attributes[key] = attributes[key]
return new_attributes