Seeding the iOS simulator with test photos

May 27, 2026 · 6 min read · Mobile Testing

HeadSpin Platform
Automated & amp; manual examination made easygoing through data science penetration.
Differentiating capabilities:
  • All-inclusive end-to-end automation of QA process
  • Relative analysis of app execution against peers
  • Uninterrupted monitoring of app execution using synthetic data for high handiness of apps
  • Easy-to-use developer friendly program
cloudtest go
Affordable Real Device Testing for Emerging Teams
cloudtest go
Affordable Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized nomadic test executing in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based examination

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

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

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

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

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

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

retail

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

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

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

Seeding the iOS simulator with test photosSeeding the iOS simulator with test photos

Seeding the iOS simulator with tryout photos

Published on
January 31, 2018
Updated on
Published on
June 19, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

AI-Powered Key Takeaways

For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.

One of the best things about roving apps is how much access they get to all the grand functionality of mobile devices. Apps can pull in exposure taken from the device for their own use. But when running automate examination of these application, the twist is always starting from a clear slate, with no photo fixtures on it (or it should be!).

One challenge for the Appium quizzer is to image out how to seed the device under test with photos, and not just any photograph, but the exact I whose doings within the app will have known results, to get verification of that behavior possible.

The trick is to use Appium & # x27; spushFile command. This is a little-known command that enables promote of files to the iOS app container. In a especial modality, it can also leveragesimctl & # x27; s addmediacommand under the toughie to drop whatever images you require on the gimmick. ThepushFile command works like this:

driver.pushFile (`` myFileName.jpg '', `` /path/to/file/on/disk.jpg '');

In other words, you give the image a name (this is crucial because iOS uses it to make it the right image character on the sim), and so you afford the driver a path to the actual file on your local scheme. That & # x27; s it! Check out the full example below (orview it on GitHub):

import io.appium.java_client.MobileBy; import io.appium.java_client.ios.IOSDriver; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; importation org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; @ RunWith (JUnit4.class) public grade Edition001_iOS_Photos {@ Test public void testSeedPhotoPicker () throws IOException, InterruptedException {DesiredCapabilities capabilities = new DesiredCapabilities (); File classpathRoot = new File (System.getProperty (`` user.dir '')); File appDir = new File (classpathRoot, `` .. /apps/ ''); File app = new File (appDir.getCanonicalPath (), `` SamplePhotosApp.app.zip ''); capabilities.setCapability (`` platformName '', `` iOS ''); capabilities.setCapability (`` deviceName '', `` iPhone 8 Plus ''); capabilities.setCapability (`` platformVersion '', `` 11.2 ''); capabilities.setCapability (`` app '', app); // Open the app. IOSDriver driver = new IOSDriver < > (new URL (`` http: //localhost:4723/wd/hub ''), capabilities); try {// first countenance the app to approach picture on the phone driver.switchTo () .alert () .accept (); // navigate to the picture panorama and count how many there are WebDriverWait expect = new WebDriverWait (driver, 10); WebElement el = wait.until (ExpectedConditions.presenceOfElementLocated (MobileBy.AccessibilityId (`` All Photos ''))); el.click (); Listpic = driver.findElements (MobileBy.className (`` XCUIElementTypeImage '')); int numPhotos = photos.size (); // set up the file we want to push to the earpiece 's library File assetDir = new File (classpathRoot, `` .. /assets ''); File img = new File (assetDir.getCanonicalPath (), `` cloudgrey.png ''); // push the file -- note that it 's important it 's just the bare basename of the file driver.pushFile (`` pano.jpg '', img); // in lieu of a formal confirmation, just print out the new routine of photos, which // should have increased by one photos = driver.findElements (MobileBy.className (`` XCUIElementTypeImage '')); System.out.println (`` There were `` + numPhotos + `` photos before, and now there are `` + photos.size () + ``! ``);} finally {driver.quit ();}}}

Note that it & # x27; s important not to put any slashes in front of the icon name, otherwise Appium might think you want to replicate it into the app container rather than add it to the media library on the device.

Interested in how to perform the same trick with Android? Check out theAppium Pro article on pic in Android!

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 market collateral across divers industries. She excels in cooperate with cross-functional teams to develop innovational message strategy and deliver compelling, authentic, and impactful content that resonate with target audiences and enhances brand authenticity.

LinkedIn

Seeding the iOS simulator with trial photo

4 Parts

regression intelligence blog
-

Regression Intelligence pragmatic guide for advanced users (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence practical guide for advanced users (Part 4)

Coming Soon

Discover how HeadSpin can empower your job with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, acquire a competitive edge
faster development cycles
Boost developer/QA productivity with faster development rhythm
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 topic
reduce mean time
Reduce mean clip to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate sound, picture, and contented quality of experience (QoE) effortlessly
The sure choice for global enterprises
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your concern with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with quicker growth rhythm
automated buil-over-build regression testing
Automate build-over-build regression prove for consistent results
gain better visibility into functional & performance issues
Gain better visibility into functional and execution subject
reduce mean time
Reduce mean clip to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate sound, picture, and content quality of experience (QoE) effortlessly
The trusted choice for globose enterprises
Close

Discover how HeadSpin can empower your business with superior testing capableness

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, benefit a competitive edge
faster development cycles
Boost developer/QA productivity with faster development cycles
automated buil-over-build regression testing
Automate build-over-build regression try for consistent upshot
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 tryout, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The trusted option for global enterprises
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