For a long time, I relied almost exclusively on emulators and simulators. They are fast and convenient, but they lie. They don’t simulate thermal throttling, unpredictable network latency, or the actual touch-latency of a physical screen. If you want to ensure your app doesn’t crash when a user switches apps or receives a call, you need to know how to run Appium tests on real devices.

In my experience, the jump from virtual to physical devices is where most automation engineers hit a wall. Between USB debugging, OEM-specific settings, and driver mismatches, it can be a nightmare. This guide will walk you through the exact process I use to get a stable real-device testing pipeline running.

Prerequisites

Before we dive into the configuration, ensure you have the following installed on your machine:

Step 1: Prepare the Physical Device

You can’t just plug a phone in and start scripting; you have to unlock the “developer gate.”

For Android Devices:

  1. Go to Settings > About Phone and tap Build Number seven times until “Developer mode” is enabled.
  2. Navigate to Settings > System > Developer Options.
  3. Enable USB Debugging.
  4. Connect the device to your PC and accept the RSA fingerprint prompt on the phone screen.
  5. Verify the connection by running adb devices in your terminal. You should see your device ID listed.

For iOS Devices:

  1. Install Xcode and open your project.
  2. Enable Developer Mode on the iPhone (Settings > Privacy & Security > Developer Mode).
  3. Connect the device and “Trust this Computer” when prompted.
  4. You will need to configure a Provisioning Profile and Signing Certificate in Xcode to allow the Appium WebDriverAgent to install on the device.

As shown in the image below, verifying your device connection via the terminal is the critical first step to ensure the Appium server can actually “see” the hardware.

Terminal window showing successful adb devices connection for a real Android device
Terminal window showing successful adb devices connection for a real Android device

Step 2: Configure Desired Capabilities

The DesiredCapabilities object is how you tell Appium which device to target. When moving from emulators to real devices, these parameters change significantly.

from appium import WebDriver

capabilities = {
    'platformName': 'Android',
    'appium:deviceName': 'Android Real Device',
    'appium:udid': 'your_device_udid_here', # Find this via 'adb devices'
    'appium:automationName': 'UiAutomator2',
    'appium:app': '/path/to/your/app.apk',
    'appium:ensureStopWithReset': True
}

driver = WebDriver(command_executor='http://127.0.0.1:4723', options=capabilities)

Pro Tip: Always use the udid (Unique Device Identifier). If you have multiple devices plugged in, deviceName is often ignored, and Appium might pick the wrong one.

Step 3: Running the Tests

Once your capabilities are set and your device is recognized, start the Appium server:

appium

Now, run your Python script. I recommend starting with a simple “Smoke Test”—something that just opens the app and checks if the home screen is visible—before running your full regression suite. If you find that managing local hardware is becoming a bottleneck (e.g., you need 10 different OS versions), I highly suggest using Kobiton for mobile device testing to access a cloud-based real device farm.

Pro Tips for Stability

Troubleshooting Common Issues

Issue Likely Cause Solution
Device not found USB Debugging off / Bad cable Check adb devices and cable connection.
SessionNotCreatedException Driver mismatch Run appium driver install uiautomator2.
WebDriverAgent failed (iOS) Signing issue Check Xcode provisioning profiles.

What’s Next?

Now that you know how to run Appium tests on real devices, the next step is scaling. Manual execution is fine for one device, but for professional CI/CD, you’ll want to explore Parallel Execution. I’ve written extensively about automating workflows; check out my other guides on optimizing automation pipelines and essential productivity tools for developers to speed up your feedback loop.