I need to make a test on a mobile app where i click on a button that add some text to the clipboard.
And i want to control it with an assertion to check if the last clipboard match with my data test, but i didn’t find how to get to the last clipboard without all the click to get it (open keyboard, click on clipboard button, and find the last one…)
Is there a way to get the last clipboard on a mobile app ?
After the step where you click save to clipboard, run the following:
//Set clipboardData equal to contents of clipboard
def clipboardData = clipboard.getData(DataFlavor.stringFlavor)
//Print value of clipboardData
println('Clipboard Data is: ' + clipboardData)
Check in your console logs if you see a line starting with 'Clipboard Data is: ’
I am not sure how this is supposed to work.
I am not familiar with awt but looks more like it will grab the content of the clipboard of the host where Katalon/KRE is running.
(which is not a bad thing, may be useful in some other cases)
The OP needs to access the clipboard of the (remote) mobile device subject to test, so using DriverFactory is more appropiate… and readable, IMHO
the String getClipboardText() { method (where you used the driver.getClipboard(ClipboardContentType.PLAINTEXT); signature) is useless, it does nothing
(at least for the current case)