Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

resolved merge conflicts

PaperBoardOfficial9f8218f55664
diff --cc browser_use/controller/service.py
index e17fe8d44,dc526bc36..84bc80e93
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@@ -21,9 -22,7 +22,8 @@@ from browser_use.controller.views impor
ClickElementByXpathAction,
CloseTabAction,
DoneAction,
+ DragDropAction,
GoToUrlAction,
- GroupTabsAction,
InputTextAction,
NoParamsAction,
OpenTabAction,
@@@ -32,10 -30,9 +32,10 @@@
SearchGoogleAction,
SendKeysAction,
SwitchTabAction,
- UngroupTabsAction,
+ WaitForElementAction,
)
from browser_use.utils import time_execution_sync
+from playwright.async_api import Page, ElementHandle
logger = logging.getLogger(__name__)
diff --cc browser_use/controller/views.py
index 15c0dd291,b7519a91f..43a15959c
--- a/browser_use/controller/views.py
+++ b/browser_use/controller/views.py
@@@ -81,29 -96,3 +96,24 @@@ class NoParamsAction(BaseModel)
def ignore_all_inputs(cls, values):
# No matter what the user sends, discard it and return empty.
return {}
+
- class Config:
- # If you want to silently allow unknown fields at top-level,
- # set extra = 'allow' as well:
- extra = 'allow'
-
+class Position(BaseModel):
+ x: int
+ y: int
+
+class DragDropAction(BaseModel):
+ # Element-based approach
+ element_source: Optional[str] = Field(None, description="CSS selector or XPath of the element to drag from")
+ element_target: Optional[str] = Field(None, description="CSS selector or XPath of the element to drop onto")
+ element_source_offset: Optional[Position] = Field(None, description="Precise position within the source element to start drag (in pixels from top-left corner)")
+ element_target_offset: Optional[Position] = Field(None, description="Precise position within the target element to drop (in pixels from top-left corner)")
+
+ # Coordinate-based approach (used if selectors not provided)
+ coord_source_x: Optional[int] = Field(None, description="Absolute X coordinate on page to start drag from (in pixels)")
+ coord_source_y: Optional[int] = Field(None, description="Absolute Y coordinate on page to start drag from (in pixels)")
+ coord_target_x: Optional[int] = Field(None, description="Absolute X coordinate on page to drop at (in pixels)")
+ coord_target_y: Optional[int] = Field(None, description="Absolute Y coordinate on page to drop at (in pixels)")
+
+ # Common options
+ steps: Optional[int] = Field(10, description="Number of intermediate points for smoother movement (5-20 recommended)")
+ delay_ms: Optional[int] = Field(5, description="Delay in milliseconds between steps (0 for fastest, 10-20 for more natural)")