{"id":1907,"library":"appium-python-client","title":"Appium Python Client","description":"The Appium Python Client is a client library for Appium, a mobile automation framework that allows testing of native, hybrid, and mobile web apps. It wraps standard Selenium WebDriver commands to provide Appium-specific extensions for mobile gestures and functionalities. The current version is 5.3.0, and it maintains a frequent release cadence, often addressing bug fixes and minor enhancements.","status":"active","version":"5.3.0","language":"en","source_language":"en","source_url":"https://github.com/appium/python-client","tags":["appium","mobile testing","automation","selenium","android","ios","e2e testing"],"install":[{"cmd":"pip install Appium-Python-Client","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Appium Python Client builds on top of Selenium WebDriver for web automation functionalities.","package":"selenium","optional":false}],"imports":[{"note":"The `webdriver` object is now directly available under the `appium` top-level package.","wrong":"from appium.webdriver import webdriver","symbol":"webdriver","correct":"from appium import webdriver"},{"note":"Specific option classes are found in `appium.options.common.base` or platform-specific submodules.","wrong":"from appium.options.common import AppiumOptions","symbol":"AppiumOptions","correct":"from appium.options.common.base import AppiumOptions"},{"note":"`MobileBy` was deprecated; `AppiumBy` is the current standard for Appium-specific locator strategies.","wrong":"from appium.webdriver.common.mobileby import MobileBy","symbol":"AppiumBy","correct":"from appium.webdriver.common.appiumby import AppiumBy"}],"quickstart":{"code":"import os\nfrom appium import webdriver\nfrom appium.options.common.base import AppiumOptions\nfrom appium.webdriver.common.appiumby import AppiumBy\n\nAPPIUM_SERVER_URL = os.environ.get('APPIUM_SERVER_URL', 'http://localhost:4723')\n\noptions = AppiumOptions()\noptions.platformName = os.environ.get('APPIUM_PLATFORM_NAME', 'Android')\noptions.automationName = os.environ.get('APPIUM_AUTOMATION_NAME', 'UiAutomator2')\noptions.deviceName = os.environ.get('APPIUM_DEVICE_NAME', 'Android Emulator')\noptions.appPackage = os.environ.get('APPIUM_APP_PACKAGE', 'com.android.settings')\noptions.appActivity = os.environ.get('APPIUM_APP_ACTIVITY', '.Settings')\n\nprint(f\"Connecting to Appium server at: {APPIUM_SERVER_URL}\")\nprint(f\"Using capabilities: {options.to_capabilities()}\")\n\ndriver = None\ntry:\n    driver = webdriver.Remote(APPIUM_SERVER_URL, options=options)\n    print(\"Driver initialized successfully.\")\n\n    # Example action: Find and click 'Display' setting\n    # Requires an Android emulator/device with the default Settings app\n    el = driver.find_element(AppiumBy.ACCESSIBILITY_ID, \"Display\")\n    print(f\"Found element: {el.text}\")\n    el.click()\n    print(\"Clicked 'Display' setting.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    if driver:\n        driver.quit()\n        print(\"Driver quit.\")","lang":"python","description":"This quickstart demonstrates how to connect to an Appium server, define basic Android capabilities using `AppiumOptions`, initialize the `webdriver.Remote` instance, and perform a simple element interaction (finding and clicking an element by accessibility ID). Ensure the Appium server (Node.js) is running before executing this script. Environment variables are used for flexibility, with sensible defaults."},"warnings":[{"fix":"Instead of `webdriver.Remote(command_executor, desired_capabilities=caps)`, use `options = AppiumOptions(); options.platformName = 'Android'; ...; webdriver.Remote(command_executor, options=options)`.","message":"The `desired_capabilities` dictionary for `webdriver.Remote` has been replaced by `options` objects (e.g., `AppiumOptions`). Passing a dictionary directly will likely lead to errors or unexpected behavior.","severity":"breaking","affected_versions":"5.0.0+ (aligning with Appium 2.x and Selenium 4)"},{"fix":"Use the unified `driver.find_element(AppiumBy.STRATEGY, \"locator_value\")` pattern. For example, `driver.find_element(AppiumBy.ID, \"someId\")`.","message":"Direct `find_element_by_*` methods (e.g., `find_element_by_id`, `find_element_by_xpath`) are deprecated and largely removed, aligning with Selenium 4 changes.","severity":"breaking","affected_versions":"5.0.0+ (aligning with Appium 2.x and Selenium 4)"},{"fix":"Ensure your `APPIUM_SERVER_URL` or `command_executor` points to `http://localhost:4723`.","message":"For Appium server 2.x, the default URL changed from `http://localhost:4723/wd/hub` to simply `http://localhost:4723`. Using the old `/wd/hub` path will result in connection failures.","severity":"gotcha","affected_versions":"5.0.0+ (when connecting to Appium server 2.x+)"},{"fix":"Install Appium globally via `npm install -g appium` and start it with `appium` in your terminal before running tests.","message":"The Appium server (the Node.js application) must be installed and running independently before you can execute any Python client scripts. The Python client acts as a bridge to the server.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Import and use `from appium.options.android import UiAutomator2Options` or `from appium.options.ios import XCUITestOptions` and instantiate them instead of `AppiumOptions`.","message":"While `AppiumOptions` is a base class, for real-world scenarios, it's often more appropriate and robust to use platform-specific option classes like `UiAutomator2Options` (for Android) or `XCUITestOptions` (for iOS). These provide specific capabilities and validations.","severity":"gotcha","affected_versions":"5.0.0+"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}