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
browser.setClipboard(content, contentType, label)
Parameters
| Name | Type | Details |
|---|---|---|
content | string | Base64-encoded string to set as clipboard content. |
contentTypeoptional | string | Content type (e.g. 'plaintext', 'image', 'url'). Android only supports 'plaintext'. |
labeloptional | string | Clipboard 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
备注
Refer to the official Appium driver documentation to see which driver versions support this command.