wrap page evaluate with timeout (#1133)

This commit is contained in:
LawyZheng
2024-11-05 11:11:27 +08:00
committed by GitHub
parent 281feb60e4
commit 8b53bc4257
7 changed files with 60 additions and 119 deletions

View File

@@ -213,6 +213,9 @@ class SkyvernElement:
return False
async def is_file_input(self) -> bool:
return self.get_tag_name() == InteractiveElement.INPUT and await self.get_attr("type") == "file"
def is_interactable(self) -> bool:
return self.__static_element.get("interactable", False)
@@ -507,7 +510,9 @@ class SkyvernElement:
await page.mouse.click(click_x, click_y)
async def blur(self) -> None:
await self.get_frame().evaluate("(element) => element.blur()", await self.get_element_handler())
await SkyvernFrame.evaluate(
frame=self.get_frame(), expression="(element) => element.blur()", arg=await self.get_element_handler()
)
async def scroll_into_view(self, timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS) -> None:
element_handler = await self.get_element_handler(timeout=timeout)