refresh options before doing select (#2537)

This commit is contained in:
Shuchang Zheng
2025-05-29 20:41:36 -07:00
committed by GitHub
parent 47709dc0d8
commit f0b0a22d25
3 changed files with 17 additions and 0 deletions

View File

@@ -795,6 +795,18 @@ class SkyvernElement:
LOG.warning("Failed to navigate to the <a> href link", exc_info=True, href=href, current_url=page.url)
raise
async def refresh_select_options(self) -> tuple[list, str] | None:
if self.get_tag_name() != InteractiveElement.SELECT:
return None
frame = await SkyvernFrame.create_instance(self.get_frame())
options, selected_value = await frame.get_select_options(await self.get_element_handler())
self.__static_element["options"] = options
if "attributes" in self.__static_element:
self.__static_element["attributes"]["selected"] = selected_value
self._attributes = self.__static_element["attributes"]
return options, selected_value
class DomUtil:
"""