close select2 when failed to select (#498)

This commit is contained in:
LawyZheng
2024-06-21 15:12:26 +08:00
committed by GitHub
parent 0ab41a207a
commit 49d7e77b3a
2 changed files with 27 additions and 18 deletions

View File

@@ -167,6 +167,9 @@ class Select2Dropdown:
# wait for the options to load
await asyncio.sleep(3)
async def close(self, timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS) -> None:
await self.page.locator("#select2-drop").press("Escape", timeout=timeout)
async def get_options(self) -> typing.List[SkyvernOptionType]:
options = await get_select2_options(self.page)
return typing.cast(typing.List[SkyvernOptionType], options)