Skip to main content

Clipboard · SetClipboard

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Read the device clipboard, or write it by passing text. These call app_clipboard.

Clipboard​

public string Clipboard()

What the device clipboard holds. iOS only: on Android 10 and later only an app with focus may read the clipboard and the UiAutomator2 server has no activity, so it would answer "empty" for a clipboard that is full — this throws there instead.

SetClipboard​

public void SetClipboard(string text)

Writes the device clipboard. On iOS the write is confirmed by reading it back; on Android it is reported as sent.

Examples​

Put text on the clipboard​

device.SetClipboard("hello there");

The same call from the command line, mobium clipboard "hello there", printed on an Android 15 emulator:

wrote "hello there" to the clipboard — Android cannot read it back, so this is the write reported as sent. Paste into a field to see it

mobium clipboard "hello there" on an Android 15 emulator

mobium clipboard "hello there" on an Android 15 emulator

Read the clipboard​

string text = device.Clipboard();

The same call from the command line, mobium clipboard, was refused, exit 5 on an Android 15 emulator:

error: the uiautomator2 backend cannot read the clipboard. On Android 10 and later only an app with focus may read it, and the UiAutomator2 server has no activity of its own — it answers with an empty string however full the clipboard is, which would be reported as "empty" rather than as "unknown". Pass text to write one; to check a write, paste into a field and read that