device is a runtime proxy over the iOS simulator and device API. Use it for device-level operations — such as injecting camera or audio input, managing photos, recording audio, simulating network conditions, or installing configuration profiles — that sit outside app UI interactions. Use driver for interacting with the app itself.
device is only available while a flow is running.
injectCamera
Replaces the app’s camera input with a provided image or video. Affects photo capture, video data output, video recording, and preview layers.
injectAudio
Replaces the app’s microphone input with a provided audio file. Affects AVAudioRecorder and AVCaptureAudioDataOutput.
injectBarcode
Injects a barcode or QR code detection into the app’s AVCaptureMetadataOutput. The injected barcode is delivered to the app’s metadata output delegate as if scanned by the camera. The config file is auto-consumed after delivery.
injectBeacon
Injects iBeacon detections into the app’s CLLocationManager. Always triggers a region-entry callback. When beacons is provided, also triggers ranging callbacks.
installConfigurationProfile
Installs a configuration profile on the iOS simulator or device. Returns a cleanup function that removes the profile when called.
setWebViewDebugging
Enables or disables WebView debugging (Safari Web Inspector) for all WKWebView instances in the app. When enabled, WKWebViews become inspectable via Safari DevTools. The default behavior is enabled.
savePhoto
Saves an image file to the device’s Photos library.
listPhotos
Returns a list of all photo and video assets in the device’s Photos library.
deleteAllPhotos
Deletes all photos and videos from the device’s Photos library. Use this for test teardown to restore a clean state between runs.
startSpeakerRecording
Starts a recording session that captures audio output from the device speaker. Returns a session object with the ID needed to stop the recording.
stopSpeakerRecording
Stops an active speaker recording session. Also calculates the audio fingerprint automatically. Returns the recorded file details.
downloadSpeakerRecording
Downloads the recorded audio file as a Buffer in WAV format.
startSpeakerRecording, stopSpeakerRecording, and downloadSpeakerRecording:
calculateAudioFingerprint
Calculates an audio fingerprint from a WAV audio buffer or file path. Use this to compare recorded audio against a known reference without byte-for-byte comparison.
simulateNetworkCondition
Simulates a degraded network condition on the device. Returns a cleanup function that restores normal network conditions when called.
Example:
getNetworkCondition
Returns the current network simulation state.
routeTraffic
Routes network traffic for specific apps or domains through a tunnel. Returns a cleanup function that restores default routing when called.
getNetworkStatus
Returns the current network routing status including VPN state, active tunnels, and routed apps.
subscribeNetworkLogs
Subscribes to real-time network log events streamed from the Appium plugin. Returns a subscription object with on() and close() methods.
RecordedEntry object contains the following fields: