

("Clipboard text was: " + note.getText()) Įxplanations are in comments above. retrieve the content and do something with it Wait.until(ExpectedConditions.presenceOfElementLocated(PASTE)).click()

WebElement note = wait.until(ExpectedConditions.presenceOfElementLocated(NOTE_CONTENT)) tap the note field to bring up the 'paste' button Wait.until(ExpectedConditions.presenceOfElementLocated(NEW_NOTE)).click() open up the notes app (this only exists on a real device) So let's have a look at the implementation. If we can do all these things, we'll have the value of the iOS real device clipboard in our test script, and can then do whatever we want with it.

For this reason, I chose the Notes application as a good place to paste, because: The main thing to decide when using this technique is: where should we paste the clipboard contents? We want a place where we can have a straightforward automation path to being able to paste, and we want to make sure that existing text or content doesn't get in the way. Read on to see how we implement this in code. Appium doesn't have eyes, but once text is on the screen, it can usually read the text as long as it can find the corresponding element. So once again, I asked the question: how would a user do this? How would a user see what was in the clipboard? The most obvious answer was: they would paste it somewhere, then read it with their eyes.
#1CLIPBOARD IOS ANDROID#
If we were working with an iOS simulator or an Android device, the solution would be simple: we could use driver.getClipboardText! But this method is not available for real iOS device. Tapping this button is easy enough, but what about retrieving the data from the clipboard once it's placed there? Tapping the "Copy URL" item would place the URL in the device's clipboard, so that the user can then paste it into a text message, e-mail, or whatever.
