getClipboard
Get the content of the system clipboard as a base64-encoded string.
Note: Falls back to the deprecated Appium 2 protocol endpoint if the driver does not support the
mobile:execute method.
Android only supports the plaintext content type.
Usage
browser.getClipboard(contentType)
Parameters
| Name | Type | Details |
|---|---|---|
contentTypeoptional | string | Content type to retrieve (e.g. 'plaintext', 'image', 'url'). Android only supports 'plaintext'. |
Example
getClipboard.js
it('should get the clipboard content', async () => {
const content = await browser.getClipboard()
const decoded = Buffer.from(content, 'base64').toString('utf8')
})
Returns
- <
Promise<string>>returns: Base64-encoded clipboard content.
Support
Hinweis
Refer to the official Appium driver documentation to see which driver versions support this command.