Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Log a rejected text-input target at warning, not error (#8798)
Shuchang Zheng76e7eb2770ed
diff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.pyindex e95dbf6af..b8006e51b 100644--- a/skyvern/webeye/actions/handler.py+++ b/skyvern/webeye/actions/handler.py@@ -6293,6 +6293,15 @@ class ActionHandler:exception_message=str(e),)actions_result.append(ActionFailure(e))+ except InvalidElementForTextInput as e:+ # The planner picked an element that cannot take text. The typed rejection is the failure+ # reason the run records, so the traceback adds nothing.+ LOG.warning(+ "Text input target does not support text input",+ action=action,+ exception_message=str(e),+ )+ actions_result.append(ActionFailure(e))except Exception as e:if is_driver_timeout_error(e):LOG.warning("Browser timeout while handling action", action=action, exc_info=True)diff --git a/tests/unit/test_action_execution_timeout.py b/tests/unit/test_action_execution_timeout.pyindex b7c514df9..0c4087817 100644--- a/tests/unit/test_action_execution_timeout.py+++ b/tests/unit/test_action_execution_timeout.py@@ -5,6 +5,7 @@ from unittest.mock import AsyncMock, MagicMock, patchimport pytestfrom structlog.testing import capture_logs+from skyvern.exceptions import InvalidElementForTextInputfrom skyvern.forge.sdk.models import StepStatusfrom skyvern.webeye.actions.actions import ActionType, ClickAction, WaitActionfrom skyvern.webeye.actions.handler import ActionHandler, _resolve_action_execution_timeout@@ -79,9 +80,12 @@ async def test_handler_raised_timeout_error_keeps_original_exception_type() -> N@pytest.mark.parametrize(("raised", "expected_level"),[(timeout_type("Timeout 30000ms exceeded."), "warning") for timeout_type in DRIVER_TIMEOUT_ERROR_TYPES]- + [(RuntimeError("unexpected"), "error")],+ + [+ (InvalidElementForTextInput(element_id="el", tag_name="div"), "warning"),+ (RuntimeError("unexpected"), "error"),+ ],)-async def test_only_driver_timeouts_are_demoted_from_error(raised: Exception, expected_level: str) -> None:+async def test_expected_failures_are_demoted_from_error(raised: Exception, expected_level: str) -> None:task, step, scraped_page, page = _rig()async def raising_handler(*args: object, **kwargs: object) -> None: