Robot Framework Appium Library
Robot Framework Appium Library is a mobile app testing library for Robot Framework, enabling test automation for Android and iOS applications. It acts as an Appium client, communicating with the Appium server to control mobile devices, similar to how Selenium WebDriver interacts with web browsers. The library is actively maintained, with frequent updates, including recent major versions that bring compatibility with newer Python, Appium Python Client, Selenium, and Robot Framework versions.
Common errors
-
ModuleNotFoundError: No module named 'AppiumLibrary'
cause The `robotframework-appiumlibrary` Python package is not installed in the active Python environment, or the Robot Framework interpreter cannot find it.fixEnsure `robotframework-appiumlibrary` is installed using `pip install robotframework-appiumlibrary`. If using a virtual environment or IDE (like PyCharm), verify that Robot Framework is configured to use the correct Python interpreter where the library is installed. Sometimes clearing Robot Framework caches and restarting the IDE helps. -
[ WARN ] Keyword 'AppiumLibrary.Click A Point' is deprecated. Since selenium v4, use other keywords.
cause Using a deprecated keyword that has been removed or replaced in newer versions of `robotframework-appiumlibrary`, especially after the updates for Selenium 4 and Appium 2.fixUpdate your Robot Framework tests to use the recommended alternative keywords. For 'Click A Point' or 'Click Element At Coordinates', newer methods or combinations of `Tap` with coordinates might be needed, or consider using `Click Element` with appropriate locators. Refer to the latest AppiumLibrary keyword documentation for alternatives. -
WebDriverException: Message: An unknown server-side error occurred while processing the command.
cause This generic error often indicates an issue with the Appium server, device setup, or incorrect desired capabilities provided during `Open Application`. Common causes include an Appium server not running, an invalid device UDID, an app not found, or a mismatched `platformVersion`.fixVerify that your Appium server is running and accessible at the specified URL. Double-check device connectivity (`adb devices` for Android, Xcode/instruments for iOS). Ensure all desired capabilities passed to `Open Application` are correct and match your target device and application configuration. Check Appium server logs for more specific error details.
Warnings
- breaking Keywords like `Reset Application`, `Element Name Should Be`, `Element Value Should Be`, `Zoom`, and `Long Press` were removed in AppiumLibrary v3.2.1/v3.2. Existing tests using these will fail.
- breaking AppiumLibrary v3.0.0 removed several keywords including `Click A Point`, `Click Element At Coordinates`, `Launch Application`, `Quit Application`, `Background App`, `Click Button`, and `Pinch`. The `Swipe` keyword now strictly requires named arguments.
- breaking In AppiumLibrary v2.0.0, `TouchAction` keywords were deprecated, and application management keywords like `launch_application`, `quit_application`, `reset_application` were deprecated/renamed (`Activate App` to `Activate Application`, etc.) to align with Appium Python Client changes.
- gotcha Using older `robotframework-appiumlibrary` versions (pre-3.0.0) with `Appium-Python-Client==4.0.0` or higher can lead to `ModuleNotFoundError: No module named 'appium.webdriver.common.touch_action'` errors due to changes in the underlying Appium Python Client.
Install
-
pip install robotframework-appiumlibrary
Imports
- AppiumLibrary
*** Settings *** Library AppiumLibrary
Quickstart
*** Settings ***
Documentation Simple example using AppiumLibrary.
Library AppiumLibrary
*** Variables ***
${APPIUM_SERVER_URL} http://127.0.0.1:4723/wd/hub
${ANDROID_AUTOMATION_NAME} UIAutomator2
${ANDROID_PLATFORM_NAME} Android
${ANDROID_PLATFORM_VERSION} %{ANDROID_PLATFORM_VERSION=11} # Example: read from ENV or default to 11
${ANDROID_APP} ${CURDIR}/demoapp/ApiDemos-debug.apk # Replace with your app path
*** Test Cases ***
Should Open And Close Test Application
Open Test Application
Sleep 3s
Close Application
*** Keywords ***
Open Test Application
Open Application ${APPIUM_SERVER_URL}
... automationName=${ANDROID_AUTOMATION_NAME}
... platformName=${ANDROID_PLATFORM_NAME}
... platformVersion=${ANDROID_PLATFORM_VERSION}
... app=${ANDROID_APP}
... appPackage=io.appium.android.apis
... appActivity=.app.SearchInvoke