Skip to content

Commit

Permalink
extend auto completion to support google address (#1174)
Browse files Browse the repository at this point in the history
  • Loading branch information
LawyZheng authored Nov 12, 2024
1 parent 068535b commit 46d9dad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
20 changes: 19 additions & 1 deletion skyvern/webeye/scraper/domUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,24 @@ function isInteractable(element) {
return true;
}

if (
tagName === "li" &&
element.className.toString().includes("ui-menu-item")
) {
return true;
}

// google map address auto complete
// https://developers.google.com/maps/documentation/javascript/place-autocomplete#style-autocomplete
// demo: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform
if (
tagName === "div" &&
element.className.toString().includes("pac-item") &&
element.closest('div[class*="pac-container"]')
) {
return true;
}

if (
tagName === "div" &&
element.hasAttribute("aria-disabled") &&
Expand All @@ -484,7 +502,7 @@ function isInteractable(element) {
return true;
}

if (tagName === "span" && element.closest("div[id^='dropdown-container']")) {
if (tagName === "span" && element.closest('div[id*="dropdown-container"]')) {
return true;
}

Expand Down
4 changes: 4 additions & 0 deletions skyvern/webeye/utils/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ async def is_auto_completion_input(self) -> bool:
if autocomplete and autocomplete == "list":
return True

class_name: str = await self.get_attr("class")
if "autocomplete-input" in class_name:
return True

return False

async def is_custom_option(self) -> bool:
Expand Down

0 comments on commit 46d9dad

Please sign in to comment.