Skip to content

interact

Kelly Ferrone edited this page Sep 12, 2026 · 6 revisions

interact

Perform a mouse action on an element.

MCP tool interact
HTTP POST /browser/interact

action is one of: click, double_click, right_click, hover, scroll_to.

click is the common case. hover opens menus that only appear on mouse-over. right_click opens context menus. scroll_to brings an off-screen element into view, which is often what a click on a long page needs first.

Returns the URL and title after the action, so any navigation it caused is visible in the result.

Address the element with EITHER xpath OR css, never both and never neither - e.g. xpath="//button[@type='submit']" or css="button[type=submit]".

Parameters

Name Type Required Default Notes
action string yes
xpath string no
css string no
session_id string yes over HTTP The session_id returned by /browser/open. Required here.
url string no
wait_timeout integer no 30

Returns

Field Type Notes
action string The gesture that was performed.
url string Current URL after the action.
title string Page title after the action.

Errors

Status Means
400 The request cannot succeed as sent — a missing field, a value that was rejected, or a locator that matched nothing before the wait ran out. Do not retry it unchanged.
401 Missing or wrong bearer token.
404 No such browser session. It ended, the Grid reaped it, or the id was never real. Open a new one and retry.
500 Something failed that this server did not expect.
503 The Grid could not serve this — unreachable, or no free slot for a new browser. Worth retrying after a wait.

Over MCP the same failures arrive as a tool error.

Example

MCP

interact(action="…")

HTTP

curl -X POST $SELENIUM_FLOW/browser/interact \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
    "session_id": "…",
    "action": "…"
  }'

← All actions · Installing · Deployment

Clone this wiki locally