Skip to content

upload_file

Kelly Ferrone edited this page Sep 9, 2026 · 4 revisions

upload_file

Attach a file to a file input.

MCP tool upload_file
HTTP POST /browser/upload

For anything you wrote yourself — JSON, CSV, YAML, markdown, plain text — put it straight in text and give it a filename. There is no need to encode it; the server writes the real file and sends it to the browser, which runs on another machine.

Use content (base64) only for binary, and path only for a file already on the server's filesystem. Pass exactly one of the three.

The page reads the file's type from the filename extension, so name it report.csv rather than report. If you give a name without an extension, mime_type is used to pick one.

Parameters

Name Type Required Default Notes
xpath string yes
text string no
filename string no
mime_type string no
content string no
session_id string yes over HTTP The session_id returned by /browser/open. Required here.
path string no
url string no
wait_timeout integer no 30

Returns

Field Type Notes
filename string The name the page sees for the attached file.
bytes integer Size of the file that was sent.
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

upload_file(xpath="…")

HTTP

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

← All actions · Installing · Deployment

Clone this wiki locally