Hoppa till huvudinnehåll

setClipboard

Set the content of the system clipboard.

Note: Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the mobile: execute method.

The content must be provided as a base64-encoded string. Android only supports the plaintext content type.

Usage​

await browser.setClipboard(content, contentType, label)

Parameters​

NameTypeDetails
contentstringBase64-encoded string to set as clipboard content.
contentType
optional
stringContent type (e.g. 'plaintext', 'image', 'url'). Android only supports 'plaintext'.
label
optional
stringClipboard label (Android only).

Example​

setClipboard.js
it('should set the clipboard content', async () => {
// Set plaintext clipboard content
const base64Content = Buffer.from('Hello World').toString('base64')
await browser.setClipboard(base64Content, 'plaintext')
})

Support​

Support for ios Support for android

Supported platforms: iOS, Android

anteckning

Refer to the official Appium driver documentation to see which driver versions support this command.

Welcome! How can I help?

WebdriverIO AI Copilot