Python client library for Appium mobile automation framework extending Selenium WebDriver with iOS and Android testing capabilities
npx @tessl/cli install tessl/pypi-appium-python-client@5.2.0A comprehensive Python client library for Appium, the open-source mobile automation framework. The Appium Python Client extends Selenium WebDriver with mobile-specific functionality for iOS and Android app testing, providing a unified API for mobile automation across platforms.
pip install Appium-Python-Clientfrom appium import webdriver
from appium.webdriver.common.appiumby import AppiumBy
from appium.options.android import UiAutomator2Options
from appium.options.ios import XCUITestOptionsFor specific platform options:
# Android options
from appium.options.android.uiautomator2 import UiAutomator2Options
from appium.options.android.espresso import EspressoOptions
# iOS options
from appium.options.ios.xcuitest import XCUITestOptions
from appium.options.ios.safari import SafariOptions
# Other platforms
from appium.options.mac.mac2 import Mac2Options
from appium.options.windows.windows import WindowsOptionsfrom appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.appiumby import AppiumBy
# Configure Android options
options = UiAutomator2Options()
options.platform_name = "Android"
options.device_name = "Android Emulator"
options.app = "/path/to/your/app.apk"
# Start WebDriver session
driver = webdriver.Remote("http://localhost:4723", options=options)
# Find and interact with elements
element = driver.find_element(AppiumBy.ACCESSIBILITY_ID, "button1")
element.click()
# Use mobile-specific locators
android_element = driver.find_element(AppiumBy.ANDROID_UIAUTOMATOR,
'new UiSelector().text("Login")')
# Clean up
driver.quit()The Appium Python Client follows a modular extension-based architecture:
This design enables comprehensive mobile testing capabilities while maintaining compatibility with existing Selenium-based test frameworks.
Core WebDriver functionality including session creation, element interaction, and mobile WebElement extensions. Provides the foundation for all mobile automation operations.
class WebDriver:
def __init__(self, command_executor: str, extensions: list = None,
options = None, client_config = None): ...
def start_session(self, capabilities: dict, browser_profile = None): ...
def get_status(self) -> dict: ...
def create_web_element(self, element_id: str): ...Appium-specific locator strategies for finding mobile elements across iOS and Android platforms, extending beyond standard WebDriver locators.
class AppiumBy:
ACCESSIBILITY_ID: str = "accessibility id"
ANDROID_UIAUTOMATOR: str = "-android uiautomator"
IOS_PREDICATE: str = "-ios predicate string"
IOS_CLASS_CHAIN: str = "-ios class chain"
IMAGE: str = "-image"
FLUTTER_INTEGRATION_SEMANTICS_LABEL: str = "-flutter semantics label"Application lifecycle management including installation, background/foreground control, and state querying across mobile platforms.
def background_app(self, seconds: int): ...
def is_app_installed(self, bundle_id: str) -> bool: ...
def install_app(self, app_path: str, **options): ...
def remove_app(self, app_id: str, **options): ...
def terminate_app(self, app_id: str, **options): ...
def activate_app(self, app_id: str): ...
def query_app_state(self, app_id: str) -> int: ...Hardware-level device interactions including keyboard, device rotation, location services, and hardware actions like shake and lock.
def hide_keyboard(self, key_name: str = None, key = None, strategy: str = None): ...
def is_keyboard_shown(self) -> bool: ...
def shake(self): ...
def lock(self, seconds: int = None): ...
def unlock(self): ...
def is_locked(self) -> bool: ...
def set_location(self, latitude: float, longitude: float, altitude: float = None): ...Android-specific capabilities including network management, activity control, SMS simulation, GSM operations, and power management.
def start_activity(self, app_package: str, app_activity: str, **opts): ...
def current_activity(self) -> str: ...
def set_network_connection(self, connection_type: int): ...
def toggle_wifi(self): ...
def send_sms(self, phone_number: str, message: str): ...
def set_gsm_call(self, phone_number: str, action: str): ...
def set_power_capacity(self, percent: int): ...Platform-specific capability configuration classes for Android (UiAutomator2, Espresso), iOS (XCUITest, Safari), and other platforms.
class UiAutomator2Options(AppiumOptions):
def set_capability(self, name: str, value): ...
def get_capability(self, name: str): ...
def to_capabilities(self) -> dict: ...
class XCUITestOptions(AppiumOptions):
def set_capability(self, name: str, value): ...
def get_capability(self, name: str): ...
def to_capabilities(self) -> dict: ...Appium server lifecycle management including startup, shutdown, and connectivity validation for local and remote testing scenarios.
class AppiumService:
def start(self, **kwargs): ...
def stop(self, timeout: int = None): ...
@property
def is_running(self) -> bool: ...
@property
def is_listening(self) -> bool: ...
def find_executable(executable: str) -> str: ...
def get_node() -> str: ...Advanced capabilities including context switching, screen recording, image comparison, clipboard operations, and Flutter integration.
@property
def contexts(self) -> list: ...
@property
def current_context(self) -> str: ...
def start_recording_screen(self, **options): ...
def stop_recording_screen(self) -> str: ...
def compare_images(self, base64_image1: str, base64_image2: str, **options): ...
def get_clipboard(self, content_type = None): ...
def set_clipboard(self, content: str, content_type = None): ...