DocsPage Interactionbrowser_html5_drag_drop

browser_html5_drag_drop

Browser Html5 Drag Drop

Perform HTML5 drag and drop using proper DragEvent dispatch. Use this for elements with draggable='true' attribute, sortable lists, and interfaces using the HTML5 Drag and Drop API. Dispatches dragstart, dragover, drop, and dragend events in the correct sequence.

Usage Example

12345678910111213
import asyncio
from owl_browser import OwlBrowser, RemoteConfig
# Async usage
async with OwlBrowser(config) as browser:
context = await browser.create_context()
context_id = context["context_id"]
await browser.html5_drag_drop(
context_id=context_id,
source_selector="value",
target_selector="value"
)

Parameters

Required

context_idstringrequired

The unique identifier of the browser context (e.g., 'ctx_000001')

source_selectorstringrequired

CSS selector for the draggable source element (must have draggable='true' attribute). Example: '.drag-item', '[data-id="item-1"]'

target_selectorstringrequired

CSS selector for the drop target element. The element that will receive the dropped item. Example: '.drop-zone', '#target-container'

Response

Returns a JSON object with the operation result.

{
  "success": true,
  "result": <value>
}