Skip to content

Automate browser based workflows with AI

fix(SKY-9511): make MoveAction/ScrollAction coords optional (#5821)

Celal Zamanoğlu71f87c3e2c60
diff --git a/skyvern/webeye/actions/actions.py b/skyvern/webeye/actions/actions.py
index dbd33474f..3ea88725b 100644
--- a/skyvern/webeye/actions/actions.py
+++ b/skyvern/webeye/actions/actions.py
@@ -351,8 +351,8 @@ class ScrollAction(Action):
action_type: ActionType = ActionType.SCROLL
x: int | None = None
y: int | None = None
- scroll_x: int
- scroll_y: int
+ scroll_x: int | None = None
+ scroll_y: int | None = None
class KeypressAction(Action):
@@ -370,8 +370,8 @@ class GotoUrlAction(Action):
class MoveAction(Action):
action_type: ActionType = ActionType.MOVE
- x: int
- y: int
+ x: int | None = None
+ y: int | None = None
class DragAction(Action):
diff --git a/skyvern/webeye/actions/handler.py b/skyvern/webeye/actions/handler.py
index 540851e97..ea2276500 100644
--- a/skyvern/webeye/actions/handler.py
+++ b/skyvern/webeye/actions/handler.py
@@ -2373,6 +2373,8 @@ async def handle_scroll_action(
task: Task,
step: Step,
) -> list[ActionResult]:
+ if action.scroll_x is None or action.scroll_y is None:
+ return [ActionFailure(Exception("ScrollAction is missing scroll_x/scroll_y coordinates"))]
if action.element_id:
# Element-based scrolling from extract-action prompt. Uses
# scrollNearestScrollableContainer() from domUtils.js which walks the DOM to find
@@ -2499,6 +2501,8 @@ async def handle_move_action(
task: Task,
step: Step,
) -> list[ActionResult]:
+ if action.x is None or action.y is None:
+ return [ActionFailure(Exception("MoveAction is missing x/y coordinates"))]
await EventStrategyFactory.move_cursor(page, action.x, action.y)
return [ActionSuccess()]