DocsPage Interactionbrowser_dispatch_event

browser_dispatch_event

browser_dispatch_event

Dispatch a DOM event on an element. Programmatically triggers events like 'input', 'change', 'focus', 'blur', 'submit', etc. Useful for triggering event handlers after programmatic value changes, or for simulating user interactions that don't involve mouse/keyboard input.

When to use browser_dispatch_event

Use browser_dispatch_event when you need to simulate real human interaction with page elements. It is part of Owl Browser's Page Interaction toolset and runs inside a self-hosted, source-level stealth engine, so every call inherits the same undetectable browser fingerprint as the rest of your automation — no separate anti-detect setup required.

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.dispatch_event(
context_id=context_id,
selector="#element-id",
event_type="value"
)

Parameters

Required

context_idstringrequired

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

selectorstringrequired

The element to dispatch the event on. Accepts any of: an OwlMark handle token from browser_observe (e.g. 'b7', 'l3', 'x2'), the most reliable target on an agent-rendered page; a CSS selector (e.g. '#submit-btn', '.nav-link', 'input[name="user"]'); viewport coordinates as 'XxY' (e.g. '100x200'); or a natural-language description (e.g. 'the login button'), resolved by the built-in semantic matcher.

event_typestringrequired

The DOM event type to dispatch (e.g., 'click', 'input', 'change', 'focus', 'blur', 'submit', 'mouseenter', 'mouseleave'). Any valid DOM event name is accepted

Optional

bubblesboolean

Whether the event should bubble up through the DOM tree. Default: true

Response

Returns a JSON object with the operation result.

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

Frequently Asked Questions

What does browser_dispatch_event do?

Dispatch a DOM event on an element. Programmatically triggers events like 'input', 'change', 'focus', 'blur', 'submit', etc. Useful for triggering event handlers after programmatic value changes, or for simulating user interactions that don't involve mouse/keyboard input. It belongs to Owl Browser's Page Interaction category and is available through the REST API, the Python SDK (browser.dispatch_event()), the Node.js SDK, and the MCP server.

What parameters does browser_dispatch_event accept?

browser_dispatch_event accepts 3 required parameters (context_id, selector, event_type) and 1 optional parameter. All parameters are sent as JSON in a POST request to /api/execute/browser_dispatch_event.

Is browser_dispatch_event detectable by anti-bot systems like Cloudflare or DataDome?

No. browser_dispatch_event executes inside Owl Browser's Chromium engine, which applies fingerprint spoofing at the C++ source level rather than through JavaScript patches. Every tool call shares the same consistent, human-like fingerprint, so anti-bot systems such as Cloudflare, DataDome, and Akamai see an ordinary browser.

Related Tools

browser_click

Click on an element using CSS selector, XY coordinates, or natural language description. Supports semantic element finding using AI - describe what you want to click (e.g., 'login button', 'search icon') and the system will locate the right element. Simulates a real mouse click with proper event dispatch. Optionally hold the mouse button for press-and-hold interactions using hold_ms.

browser_type

Type text into an input field with human-like keystroke simulation. Target the field using CSS selector, coordinates, or natural language (e.g., 'email field'). When selector is omitted, types into the currently focused element. Note: Does NOT clear existing content - use browser_clear_input first if you need to replace text rather than append.

browser_pick

Select an option from a dropdown or select element. Works with native HTML select elements and dynamic/custom dropdowns (like select2, react-select). Specify the option by its value or visible text. Automatically handles opening the dropdown and selecting the option.

browser_press_key

Press a keyboard key. Supports special keys (Enter, Tab, Escape, arrow keys, etc.) and single characters (a-z, A-Z, 0-9). The key is sent to the currently focused element. Common uses: Enter to submit forms, Tab to move between fields, Escape to close modals, Arrow keys for navigation in menus or sliders, or single characters for keyboard shortcuts.

browser_submit_form

Submit the currently focused form by simulating an Enter key press. Equivalent to pressing Enter in a form field. Useful for search boxes and forms that submit on Enter. The form must have a focused input element.

browser_drag_drop

Perform a mouse drag operation from start coordinates to end coordinates. Used for slider CAPTCHAs, puzzle solving, canvas drawing, and custom drag interactions. Uses realistic mouse movement with bezier curves. For HTML5 draggable elements, use browser_html5_drag_drop instead.

Browse the full Owl Browser API reference or get started with the Python SDK and Node.js SDK.