Appium
Appium Install and configure Appium and Appium Inspector for mobile automation testing on iOS and Android devices
Testing Quest #10 Intermediate

Appium

Install and configure Appium and Appium Inspector for mobile automation testing on iOS and Android devices

appiumtestingmobileautomationiosandroidinspector
Download as:

What is Appium?

Appium is an open-source automation tool for running scripts and testing native applications, mobile-web applications, and hybrid applications on Android or iOS using a WebDriver.

Appium will be used for the building and execution of automated UI tests on both Apple and Android devices.

Prerequisites

Install Appium

npm i --location=global appium

If you run into this error: Error installing Chromedriver: Cannot find module '@appium/types', run: npm install @appium/types -D

Close your terminal session after installation.

Verify Your Installation

Open a new terminal session:

appium -v

Install Appium Drivers

Check which drivers are available:

appium driver list

Install the desired drivers:

appium driver install <driver_name>

At a minimum, it is recommended to install xcuitest for iOS and uiautomator2 for Android:

appium driver install xcuitest
appium driver install uiautomator2

Start Appium Server

appium

The server will start and listen on http://0.0.0.0:4723 by default.

Do not install Appium Desktop as it is incompatible with Appium 2.x and later. The project is no longer being supported.

Companion Tools

Driver Diagnostics

Appium includes a built-in diagnostics command that validates your environment for each installed driver. It checks that all the necessary dependencies for the target platform are properly configured.

The standalone @appium/doctor package is deprecated. Use the built-in appium driver doctor command instead.

Run Diagnostics

Check a specific driver:

appium driver doctor xcuitest
appium driver doctor uiautomator2

Check a specific plugin:

appium plugin doctor <plugin_name>

Understanding the Output

SymbolMeaning
Check passed
Check failed (required fix)
Warning (optional fix)

Common Checks Performed

iOS (xcuitest):

  • Xcode is installed and has required simulators
  • Xcode Command Line Tools configured
  • Carthage installed (if using WebDriverAgent)
  • ios-deploy installed for real device testing
  • libimobiledevice installed for device communication

Android (uiautomator2):

  • ANDROID_HOME environment variable set
  • JAVA_HOME environment variable set
  • Android SDK platform-tools in PATH
  • Android SDK build-tools installed
  • Emulator available

Fixing Common Issues

ANDROID_HOME not set:

Add to your ~/.zshrc:

export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_HOME=$ANDROID_SDK_ROOT  # legacy alias
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator

JAVA_HOME not set (using SDKMAN):

export JAVA_HOME=$HOME/.sdkman/candidates/java/current

Xcode Command Line Tools not configured:

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

Good to Know

Update Drivers

# List drivers that need to be updated
appium driver list --updates

# Update a specific driver
appium driver update <driver_name>

# Update all installed drivers
appium driver update installed

Uninstall Drivers

appium driver uninstall <driver_name>

Available Drivers

DriverPlatformDescription
xcuitestiOSApple’s XCUITest framework
uiautomator2AndroidGoogle’s UiAutomator2 framework
espressoAndroidGoogle’s Espresso framework
mac2macOSmacOS desktop automation
safariiOS/macOSSafari browser automation
geckoMultipleFirefox browser automation
chromiumMultipleChrome browser automation

Troubleshooting

”appium: command not found”

The npm global bin directory may not be in your PATH:

# Check npm global prefix
npm config get prefix

# Add to ~/.zshrc
export PATH="$(npm config get prefix)/bin:$PATH"

# Source and verify
source ~/.zshrc
appium -v

Driver Installation Fails

If driver installation fails with permission errors:

# Fix npm permissions (don't use sudo with npm)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
source ~/.zshrc

# Reinstall drivers
appium driver install xcuitest

“@appium/types” Error

npm install @appium/types -D

Port Already in Use

# Find process using port 4723
lsof -i :4723

# Kill the process
kill -9 <PID>

# Or start Appium on a different port
appium --port 4724

Session Not Created

Run driver diagnostics (see the Diagnostics tab) to identify configuration issues.

Resources

🔗
Appium Documentation appium.io

Official Appium documentation with guides, API reference, and examples

🔗
Migrating to Appium 3 appium.io

Official migration guide for upgrading from Appium 2.x to 3.x

🔗
Appium Quickstart Guide appium.io

Environment setup and troubleshooting

🔗
Appium Inspector on GitHub github.com

Official repository with releases, documentation, and issue tracker

🔗
Appium Inspector Releases github.com

Download the latest version for macOS, Windows, or Linux

🔗
Appium Desired Capabilities appium.io

Complete reference for configuring Appium sessions with W3C capabilities