Retrieving Clipboard Text from a Real iOS Device

April 17, 2026 · 8 min read · Mobile Testing

HeadSpin Platform
Automated & amp; manual testing get easy through information science perceptiveness.
Differentiating capabilities:
  • Panoptic end-to-end mechanisation of QA operation
  • Comparative analysis of app performance against peers
  • Continuous monitoring of app performance using synthetic data for higher availability of apps
  • Easy-to-use developer friendly platform
cloudtest go
Affordable Existent Device Testing for Emerging Teams
cloudtest go
Low-priced Existent Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized peregrine test execution in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based examination

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

Retrieving Clipboard Text from a Real iOS DeviceRetrieving Clipboard Text from a Real iOS Device

Retrieving Clipboard Text from a Real iOS Device

Published on
May 6, 2020
Updated on
Published on
February 7, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps
retrieving-clipboard-text

In a late, I ran into a scenario where I needed to retrieve some info from an app that wasn & # x27; t usable in a text element on the screen.

Background

Specifically, I want to get the URL of a Zoom encounter I had depart, so that I could scratch its ID and word to send to another gimmick (as part of a multi-device tryout flow). As always, the first thing I did was ask, & quot; how would a user get this URL? & quot; Well, in this particular app, the most square way to get that URL is to make use of this little carte that Zoom pop up when you try to tempt someone to a encounter:

invite-someone-to-meeting

Tapping the & quot; Copy URL & quot; item would place the URL in the device & # x27; s clipboard, so that the user can so paste it into a text message, e-mail, or whatever. Tapping this button is easy enough, but what about find the datum from the clipboard once it & # x27; s placed there?

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

If we be working with an iOS simulator or an Android device, the solution would be simple: we could! But this method is not available for existent iOS device. So erst again, I enquire the interrogative: how would a user do this? How would a user see what was in the clipboard? The most obvious solution was: they would glue it someplace, then read it with their eyes. Appium doesn & # x27; t feature optic, but once text is on the screen, it can ordinarily read the textbook as long as it can find the corresponding component. Read on to see how we apply this in codification.

Pasting and Reading the Value

The primary thing to decide when using this technique is: where should we paste the clipboard content? We want a place where we can experience a straightforward automation path to being capable to paste, and we want to create certain that existing text or content doesn & # x27; t get in the way. For this reason, I chose the Notes application as a good place to paste, because:

  1. When you launch the Notes app, no matter where you are, you have the ability to make a new (blank) tone with one tap.
  2. The Notes app has one main text battlefield, whose contents Appium has access to (with a little wrinkle that I & # x27; ll depict in a instant).

The flow we need to enforce to make this happen in more particular looks like this:

  1. Get the data into the clipboard (which we have already done via the & quot; Copy URL & quot; push in my representative)
  2. Activate the Notes app
  3. Create a new white line
  4. Paste the clipboard
  5. Find the element containing the pasted contents
  6. Read the textbook from that ingredient

If we can do all these things, we & # x27; ll hold the value of the clipboard in our test script, and can so do whatever we desire with it. So let & # x27; s feature a look at the execution.

// open up the notes app (this only exists on a real device) driver.activateApp (NOTES_ID); // create a new blank billet wait.until (ExpectedConditions.presenceOfElementLocated (NEW_NOTE)) .click (); // tap the note field to bring up the 'paste ' button WebElement note = wait.until (ExpectedConditions.presenceOfElementLocated (NOTE_CONTENT)); note.click (); // glue the content wait.until (ExpectedConditions.presenceOfElementLocated (PASTE)) .click (); // recover the content and do something with it System.out.println (`` Clipboard text was: `` + note.getText ());

Explanations are in input above. For the specific locators you & # x27; ll need, see below. It & # x27; s all jolly straightforward -- simply walking through what a exploiter would do in this scenario! One thing to keep in mind is that if there is rich message in the clipboard (a URL, picture, etc ...), it will be pasted as its own element or set of elementswithinthe tone. In that cause, you & # x27; ll need to findthatelement instead of the main tone factor when retrieving message.

I & # x27; ve included a full example (too availableon Github) which should work on a existent twist (you & # x27; ll obviously necessitate to update the capabilities to something that works on your device). Note also the example of a locator for the element you & # x27; ll need to find if you & # x27; re pasting, say, a URL, and not just plain schoolbook.

public class Edition115_Clipboard_Real_IOS {private IOSDriverdriver; private WebDriverWait wait; private final atmospherics String NOTES_ID = `` com.apple.mobilenotes ''; individual final atmospherics String PHOTOS = `` com.apple.mobileslideshow ''; private final static By NEW_NOTE = MobileBy.AccessibilityId (`` New billet ''); private final static By NOTE_CONTENT = MobileBy.AccessibilityId (`` New billet ''); individual final static By PASTE = MobileBy.AccessibilityId (`` Paste ''); //private last static By LINK_IN_NOTE = By.xpath (`` //XCUIElementTypeTextView [@ name='note '] /XCUIElementTypeLink ''); @ Before public void setUp () throws MalformedURLException {DesiredCapabilities capabilities = new DesiredCapabilities (); capabilities.setCapability (`` platformName '', `` iOS ''); capabilities.setCapability (`` platformVersion '', `` 13.3 ''); capabilities.setCapability (`` deviceName '', `` iPhone 11 ''); capabilities.setCapability (`` app '', PHOTOS); capabilities.setCapability (`` automationName '', `` XCUITest ''); driver = new IOSDriver(new URL (`` http: //localhost:4723/wd/hub ''), capabilities); wait = new WebDriverWait (driver, 10);} @ After public void tearDown () {if (driver! = null) {driver.quit ();}} @ Test public nothingness testGetClipboardContents () {driver.activateApp (NOTES_ID); wait.until (ExpectedConditions.presenceOfElementLocated (NEW_NOTE)) .click (); WebElement note = wait.until (ExpectedConditions.presenceOfElementLocated (NOTE_CONTENT)); note.click (); wait.until (ExpectedConditions.presenceOfElementLocated (PASTE)) .click (); System.out.println (`` Clipboard text was: `` + note.getText ());}}
Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamic and results-driven Content Marketing Specialist with 8+ years of experience in crafting engaging narratives and marketing collateral across diverse industries. She excel in collaborating with cross-functional teams to germinate forward-looking content scheme and deliver compelling, authentic, and impactful substance that resonate with target audiences and enhances brand authenticity.

LinkedIn

Retrieving Clipboard Text from a Real iOS Device

4 Parts

regression intelligence blog
-

Regression Intelligence practical guidebook for advanced user (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence pragmatic usher for advanced users (Part 4)

Coming Soon

Discover how HeadSpin can empower your business with superior testing potentiality

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, derive a competitive edge
faster development cycles
Boost developer/QA productiveness with quicker development cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain best visibility into functional and execution subject
reduce mean time
Reduce mean time to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate sound, video, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprisingness
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your business with superior prove capability

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a militant edge
faster development cycles
Boost developer/QA productiveness with faster development round
automated buil-over-build regression testing
Automate build-over-build fixation testing for coherent issue
gain better visibility into functional & performance issues
Gain better visibility into functional and performance issues
reduce mean time
Reduce mean clip to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and contented character of experience (QoE) effortlessly
The trusted choice for worldwide enterprises
Close

Discover how HeadSpin can endue your business with superior testing potentiality

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with quicker development cycles
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain better visibility into functional and performance issues
reduce mean time
Reduce mean time to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and contented caliber of experience (QoE) effortlessly
The trusted choice for global initiative
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free