Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
add a 2-min timeout for press_sequentially (#478)
Kerem Yilmazaf81fb720625
diff --git a/skyvern/constants.py b/skyvern/constants.pyindex a08a5320a..3cd026a56 100644--- a/skyvern/constants.py+++ b/skyvern/constants.py@@ -4,3 +4,5 @@ from pathlib import PathSKYVERN_ID_ATTR: str = "unique_id"SKYVERN_DIR = Path(__file__).parentREPO_ROOT_DIR = SKYVERN_DIR.parent++INPUT_TEXT_TIMEOUT = 120000 # 2 minutesdiff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.pyindex 2dc665619..1881e0e37 100644--- a/skyvern/webeye/actions/handler.py+++ b/skyvern/webeye/actions/handler.py@@ -8,7 +8,7 @@ import structlogfrom deprecation import deprecatedfrom playwright.async_api import Locator, Page, TimeoutError-from skyvern.constants import REPO_ROOT_DIR+from skyvern.constants import INPUT_TEXT_TIMEOUT, REPO_ROOT_DIRfrom skyvern.exceptions import (ImaginaryFileUrl,InvalidElementForTextInput,@@ -268,8 +268,7 @@ async def handle_input_text_action(# If the input is a text input, we type the text character by character# 3 times the time it takes to type the text so it has time to finish typing- total_timeout = max(len(text) * TEXT_INPUT_DELAY * 3, SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS)- await locator.press_sequentially(text, timeout=total_timeout)+ await locator.press_sequentially(text, timeout=INPUT_TEXT_TIMEOUT)return [ActionSuccess()]diff --git a/skyvern/webeye/utils/dom.py b/skyvern/webeye/utils/dom.pyindex 084f4ef17..bfae0e4ee 100644--- a/skyvern/webeye/utils/dom.py+++ b/skyvern/webeye/utils/dom.py@@ -4,7 +4,7 @@ from enum import StrEnumimport structlogfrom playwright.async_api import FrameLocator, Locator, Page-from skyvern.constants import SKYVERN_ID_ATTR+from skyvern.constants import INPUT_TEXT_TIMEOUT, SKYVERN_ID_ATTRfrom skyvern.exceptions import (ElementIsNotLabel,MissingElement,@@ -17,7 +17,6 @@ from skyvern.forge.sdk.settings_manager import SettingsManagerfrom skyvern.webeye.scraper.scraper import ScrapedPageLOG = structlog.get_logger()-TEXT_INPUT_DELAY = 10def resolve_locator(scrape_page: ScrapedPage, page: Page, frame: str, xpath: str) -> Locator:@@ -97,8 +96,7 @@ class SkyvernElement:async def input_sequentially(self, text: str, default_timeout: float = SettingsManager.get_settings().BROWSER_ACTION_TIMEOUT_MS) -> None:- total_timeout = max(len(text) * TEXT_INPUT_DELAY * 3, default_timeout)- await self.locator.press_sequentially(text, timeout=total_timeout)+ await self.locator.press_sequentially(text, timeout=INPUT_TEXT_TIMEOUT)class DomUtil: