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​

clipboard(): Promise<string>

setClipboard​

setClipboard(text: string): Promise<Data>

Examples​

Put text on the clipboard​

await 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 &quot;hello there&quot; on an Android 15 emulator

mobium clipboard "hello there" on an Android 15 emulator

Read the clipboard​

const text = await 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