Skip to content
Kelly Ferrone edited this page Sep 10, 2026 · 4 revisions

frame

Move into an iframe, or back out of it.

MCP tool frame
HTTP POST /browser/frame

action is one of: switch, parent, default. Use switch with an xpath (or index) to go into a frame, parent to go up one level, and default to return to the main page.

Selenium does not look inside frames: an element in one is invisible to every locator until you switch in. The switch sticks — every later call stays in that frame until you switch back, so if a locator that should work is failing, check session://current for in_frame.

Parameters

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

Returns

Field Type Notes
action string The switch that was performed.
in_frame boolean Whether the session is now inside a frame.
url string Current URL after the action.
title string Page title after the action.

Errors are 400 for a bad argument, 401 without a token, 500 when the Grid refuses. Over MCP the same failures arrive as a tool error.

Example

MCP

frame()

HTTP

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

← All actions · Installing · Deployment

Clone this wiki locally