iOS environment setup
Midscene connects to and controls iOS devices through WebDriverAgent (WDA), supporting UI automation across native apps, hybrid apps, and system interfaces.
This guide prepares the iOS environment: build and start WDA, then make it reachable from the computer that runs Midscene. Playground, Midscene Test, and the JavaScript SDK all use this connection.
Connect the device through WDA
Midscene communicates with iOS physical devices and simulators through a running WebDriverAgent (WDA) service. If WDA is already running and reachable from your computer, skip directly to Verify the WDA service status.
Build and start WebDriverAgent
Before you begin, prepare the following iOS development environment:
- macOS (required for iOS development and device debugging)
- Xcode and Xcode Command Line Tools
- An iOS Simulator or physical iOS device
WebDriverAgent version must be >= 7.0.0.
Follow the official Appium documentation to build and start WebDriverAgent (WDA):
- Simulator setup: Run Prebuilt WDA
- Physical device setup: Real Device Configuration
Configure a physical device and forward the port
iOS Simulators expose WDA directly on localhost and do not require port forwarding—if you are using a simulator or a remote WDA service, skip to Verify the WDA service status.
When using a physical iOS device:
- Connect the device to your Mac via USB and tap Trust This Computer when prompted on the device.
- Enable Developer Mode (Settings > Privacy & Security > Developer Mode) and UI Automation (Settings > Developer > Enable UI Automation) on the device.
- After signing and starting WDA on the device, use
iproxy(installable viabrew install libimobiledevice) to forward the WDA port (8100by default) from the device to your Mac:
Replace YOUR_DEVICE_ID with your device's UDID, and keep both WDA and iproxy running. When connecting multiple devices or using custom ports, forward each device to a distinct local port and use that port in Playground or your project configuration.
Verify the WDA service status
Open the WDA /status endpoint in your browser or terminal from the computer running Midscene:
- Default local URL:
http://localhost:8100/status(if using a custom port, remote host, or gateway, use the actual service address) - Expected JSON response:
A JSON response containing "ready": true confirms that WDA is ready to accept commands. Note the WDA host and port (or gateway base URL) so you can use the same connection settings in Playground and your project.
Verify
When the WDA /status endpoint returns "ready": true, verify the environment in Playground. Open Get started, where iOS and Playground are already selected, choose how to connect a model, and follow the steps to run one aiAct action and one aiAssert assertion. A passing assertion confirms that WDA, screen capture, touch input, and model calls work together.
FAQ
Why can't I control my physical device even though WebDriverAgent is connected?
Check the following settings on your iOS device:
- Developer Mode: Make sure Settings > Privacy & Security > Developer Mode is enabled and the device has been restarted.
- UI Automation: Make sure Settings > Developer > Enable UI Automation is turned on.
- Computer Trust: Reconnect the USB cable and make sure you have tapped Trust This Computer on the device prompt.
What are the differences between iOS Simulators and physical devices?
How do I customize the WebDriverAgent port and host?
See the iOS JavaScript SDK guide.
How do I get a smoother live screen preview in Playground?
iOS Playground supports two screen preview modes:
- Polling mode (default): Captures screenshots sequentially via the WDA screenshot endpoint at roughly 5–10 fps.
- Native MJPEG stream (recommended): Connects directly to WDA's built-in MJPEG server for higher frame rates and lower latency.
To enable the native MJPEG stream on a physical device, forward WDA's MJPEG port (9100 by default) to your Mac (not required for Simulators):
Playground automatically probes local port 9100 on startup: if available, the terminal logs MJPEG: streaming via native WDA MJPEG server; otherwise, it falls back to polling mode automatically.

