iOS getClipboard() returning weird strings

I am using Java Script/WD. I want to retrieve text that is put into clipboard with: UIPasteboard.general.string = <function returning a String>

        let text = await driver.getClipboard("Plaintext);
        console.log(`Text received: "${text}`)

Is that correct use of the function? Because it outputs: UUNJIFNsb3RzIEVycm9ycwpEYXRlOiAyMDIxLTA2LTIzIDEzOjQzOjIyIFBNKzEy MDAKQ2FzaW5vIElEOiBIT1IKQ2FzaW5vIE5hbWU6IEhvcm5zYnkgSW5uClVzZXI6 IEhvcnNsb3R0ZXN0CgpBcHAgVmVyc2lvbjogIDEuMAoKQnVpbGQgTnVtYmVyOiAg NTYKCk5vIGVycm9ycyB0byByZXBvcnQ=

Which is a long way from correct

This is base64-encoded string. I assume you need to decode it. It is expected the client should do such decoding on its own. The fact it is not done could be a WD bug though.

Clipboard content as base64-encoded string or an empty string if the clipboard is empty (string)

1 Like