Workshop with appium for Android app - up1/course-appium-robotframework GitHub Wiki
Workshop with appium for Android app
- Android
List of softwares
1. Appium Server with Android app
- Config ANDROID_HOME and JAVA_HOME
Install appium server
$npm install -g appium
$appium -v
2.15.0
List of drivers
Android
$appium driver list
✔ Listing available drivers
- [email protected] [installed (npm)]
- [email protected] [installed (npm)]
- [email protected] [installed (npm)]
- espresso [not installed]
- mac2 [not installed]
- windows [not installed]
- safari [not installed]
- gecko [not installed]
- chromium [not installed]
iOS
$xcrun xctrace list devices
UIAutomator2 and Espresso for Android App
Install$appium driver install uiautomator2
$appium driver install espresso
Check Appium :: ready ?
$appium driver doctor uiautomator2
Optional tools
$npm install -g ffmpeg
$npm install -g mjpeg-consumer
Start Appium server
$appium
[Appium] Welcome to Appium v2.15.0 (REV 552db40622bb7a82d9c6d67d2d6bcf3694b47e30)
[Appium] The autodetected Appium home path: /Users/somkiatpuisungnoen/.appium
[Appium] Attempting to load driver xcuitest...
[Appium] Attempting to load driver flutter...
[Appium] Attempting to load driver uiautomator2...
2. Appium Inspector
- Capability for Devices
- Android
- iOS
Example for Android
- Remote Path = ''
{
"platformName": "Android",
"appium:app": "/Users/somkiatpuisungnoen/data/slide/appium/2025/app-login-debug.apk",
"appium:deviceName": "emulator-5554",
"appium:automationName": "UiAutomator2"
}
{
"platformName": "Android",
"appium:automationName": "UiAutomator2",
"appium:appPackage": "com.demo.mylogin"
}
List of devices
$adb devices
3. Install plugins
- Interceptor
- Wait
$appium plugin list
$appium plugin install --source=npm appium-interceptor
$appium plugin install --source=npm appium-wait-plugin
4. Write test script with Robot framework
$pip install --upgrade robotframework
$pip install --upgrade robotframework-appiumlibrary
Workshop
- Working with AppiumLibrary
- Open Application
- Close and Quit application
- Selector => id, name, accessibility and XPath
- Waiting for element
- Robot framework User Guide
- Read file and compare data with OperatingSystem and Build in library
- String library
Example test case
*** Settings ***
Library AppiumLibrary
Test Teardown Close Application
*** Test Cases ***
Success with login
Open Application http://127.0.0.1:4723
... platformName=Android
... appium:app=/Users/somkiatpuisungnoen/data/slide/appium/2025/app-login-debug-id.apk
... appium:deviceName=emulator-5554
... appium:automationName=UiAutomator2
... appium:ensureWebviewsHavePages=${True}
... appium:nativeWebScreenshot=${True}
... appium:newCommandTimeout=${3600}
... appium:connectHardwareKeyboard=${True}
${el1} = Set Variable android=new UiSelector().resourceId("testTagLoginName")
Wait Until Page Contains Element xpath=//android.widget.EditText[@resource-id="testTagLoginName"]
Wait Until Page Contains Element xpath=//*[@resource-id="testTagLoginName"]
Wait Until Element Is Visible ${el1}
Click Element ${el1}
Input Text ${el1} [email protected]
Hide Keyboard
${el2} = Set Variable android=new UiSelector().resourceId("testTagLoginPassword")
Wait Until Page Contains Element xpath=//android.widget.EditText[@resource-id="testTagLoginPassword"]
Wait Until Page Contains Element xpath=//*[@resource-id="testTagLoginPassword"]
Wait Until Element Is Visible ${el2}
Click Element ${el2}
Input Text ${el2} mypassword
Hide Keyboard