optimize async task and remove hover (#1095)

This commit is contained in:
LawyZheng
2024-10-31 10:49:02 +08:00
committed by GitHub
parent 326e749f83
commit 00549c921b
4 changed files with 32 additions and 18 deletions

View File

@@ -456,6 +456,34 @@ class SkyvernElement:
async def input_clear(self, timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS) -> None:
await self.get_locator().clear(timeout=timeout)
async def move_mouse_to_safe(
self,
page: Page,
task_id: str | None = None,
step_id: str | None = None,
timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS,
) -> tuple[float, float] | tuple[None, None]:
element_id = self.get_id()
try:
return await self.move_mouse_to(page, timeout=timeout)
except NoElementBoudingBox:
LOG.warning(
"Failed to move mouse to the element - NoElementBoudingBox",
task_id=task_id,
step_id=step_id,
element_id=element_id,
exc_info=True,
)
except Exception:
LOG.warning(
"Failed to move mouse to the element - unexpectd exception",
task_id=task_id,
step_id=step_id,
element_id=element_id,
exc_info=True,
)
return None, None
async def move_mouse_to(
self, page: Page, timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS
) -> tuple[float, float]: