The Appium Python client is the library that connects your Python test code to the Appium server. It wraps the W3C WebDriver HTTP protocol and provides AndroidDriver, IOSDriver, and all the mobile-specific commands you'll use throughout this course.
What you need before starting
- Python 3.9 or later (
python3 --version) - Node.js 18 or later (
node --version) - JDK 11 or later (required by Android SDK tools)
- Appium server installed globally via npm
- Android Studio (for emulators) or Xcode (for iOS simulators)
Installing the Appium Python client
pip install Appium-Python-ClientThis installs version 3.x, which supports the W3C Actions API and the typed options classes (UiAutomator2Options, XCUITestOptions). Verify:
python -c "import appium; print(appium.__version__)"Installing Appium server and drivers
# Install Appium server globally
npm install -g appium
# Verify
appium --version
# Install platform drivers
appium driver install uiautomator2 # Android
appium driver install xcuitest # iOS
# Verify drivers installed
appium driver list --installedStarting Appium server
appium --base-path /The --base-path / sets the base path to / — the Appium Python client defaults to this. Without it, session creation requests go to /session but Appium listens at /wd/hub/session (the old Selenium path), causing connection errors.
Verifying the installation with a minimal script
Create verify_setup.py:
from appium import webdriver
from appium.options import UiAutomator2Options
options = UiAutomator2Options()
options.device_name = "emulator-5554"
options.app = "/path/to/your/app.apk"
# This will fail if Appium isn't running or the device isn't connected
# That's expected — we just want the import to work
try:
driver = webdriver.Remote("http://127.0.0.1:4723", options=options)
print("Session created successfully")
driver.quit()
except Exception as e:
if "refused" in str(e).lower():
print("Imports OK. Start Appium server and try again.")
else:
print(f"Unexpected error: {e}")Run it:
python verify_setup.pyIf you see "Imports OK" (or "Session created successfully"), the client is installed correctly.
Installing Appium Inspector
Appium Inspector is the GUI tool for inspecting element hierarchies. Install it from github.com/appium/appium-inspector/releases — download the .dmg (macOS) or .exe (Windows).
Configure it with:
- Remote Host:
127.0.0.1 - Remote Port:
4723 - Remote Path:
/
Then start a session with Android or iOS capabilities to inspect your app's element tree.
Common installation problems
Python client version mismatch: Appium Python Client 2.x and 3.x have different import paths. This course uses 3.x. If you see ImportError: cannot import name 'UiAutomator2Options', upgrade:
pip install --upgrade Appium-Python-ClientAppium not found after npm install: npm global packages may not be on PATH. Check:
npm config get prefix
# Add <prefix>/bin to your PATHuiautomator2 driver not found: After appium driver install uiautomator2, if Appium still can't find it, run appium driver list --installed to confirm the installation path matches Appium's search path.
JDK not found: Android tooling requires JAVA_HOME to point to a JDK:
export JAVA_HOME=$(/usr/libexec/java_home) # macOS
java -version