Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
fix id selector (#573)
LawyZhengda66d66132bf
diff --git a/skyvern/webeye/scraper/domUtils.js b/skyvern/webeye/scraper/domUtils.jsindex ed302212e..325b3509b 100644--- a/skyvern/webeye/scraper/domUtils.js+++ b/skyvern/webeye/scraper/domUtils.js@@ -630,14 +630,14 @@ async function getSelect2OptionElements(element) {while (true) {oldOptionCount = optionList.length;let newOptionList = document.querySelectorAll(- "#select2-drop li[role='option']",+ "[id='select2-drop'] li[role='option']",);if (newOptionList.length === oldOptionCount) {console.log("no more options loaded, wait 5s to query again");// sometimes need more time to load the options, so sleep 10s and try againawait sleep(5000); // wait 5snewOptionList = document.querySelectorAll(- "#select2-drop li[role='option']",+ "[id='select2-drop'] li[role='option']",);console.log(newOptionList.length, " options found, after 5s");}diff --git a/skyvern/webeye/utils/dom.py b/skyvern/webeye/utils/dom.pyindex 3c916276d..5ccaf2392 100644--- a/skyvern/webeye/utils/dom.py+++ b/skyvern/webeye/utils/dom.py@@ -197,7 +197,7 @@ class SkyvernElement:if for_id == "":return None- locator = self.get_frame().locator(f"#{for_id}")+ locator = self.get_frame().locator(f"[id='{for_id}']")# supposed to be only one element, since id is unique in the whole DOMif await locator.count() != 1:return None@@ -349,7 +349,7 @@ class Select2Dropdown(AbstractSelectDropdown):self.frame = frameasync def __find_anchor(self, timeout: float) -> Locator:- locator = self.frame.locator("#select2-drop")+ locator = self.frame.locator("[id='select2-drop']")await locator.wait_for(state="visible", timeout=timeout)cnt = await locator.count()if cnt == 0:@@ -415,7 +415,7 @@ class ComboboxDropdown(AbstractSelectDropdown):async def __find_anchor(self, timeout: float) -> Locator:control_id = await self.skyvern_element.get_attr("aria-controls", timeout=timeout)- locator = self.frame.locator(f"#{control_id}")+ locator = self.frame.locator(f"[id='{control_id}']")await locator.wait_for(state="visible", timeout=timeout)cnt = await locator.count()if cnt == 0: