![1clipboard ios 1clipboard ios](https://pic2.zhimg.com/v2-158d7fde65e6c28a594e841651a622d1_r.jpg)
("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. Find the element containing the pasted contents.Get the data into the clipboard (which we have already done via the "Copy URL" button in my example).The flow we need to implement to make this happen in more detail looks like this: The Notes app has one main text field, whose contents Appium has access to (with a little wrinkle that I'll describe in a moment).When you launch the Notes app, no matter where you are, you have the ability to create a new (blank) note with one tap.For this reason, I chose the Notes application as a good place to paste, because:
![1clipboard ios 1clipboard ios](https://www.lizhi.io/wp-content/uploads/2018/07/05-Paste-750x168.jpg)
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.