Getting Started with Appium for Android
Contents
Android Support
OS Support
Part 1
o Real Device Setup
o Windows Desktop Setup
o Appium Project Setup
Part 2
o Basics of Appium
o Code Explanation
Part 3
o 3.1 Test Execution
o 3.2 Element Inspection
References
Appium is an open source test automation framework for use with native, hybrid and mobile
web apps.
It drives iOS, Android, and Windows apps using the WebDriver protocol.
Android Support
Android automation is supported with two drivers:
The UiAutomator2 Driver
The Espresso Driver
The (deprecated) UiAutomator Driver
Android Versions 4.3 and up are supported via Appium's UiAutomator and
UiAutomator2 libraries. UiAutomator is the default driver.
Devices: Android emulators and real Android devices
Native app support: Yes
Mobile web support: Yes. Automation is effected using a
bundled Chromedriver server as a proxy. With 4.3, automation works on official
Chrome browser or Chromium only. With 4.4+, automation also works on the built-
in "Browser" app. Chrome/Chromium/Browser must already be installed on the
device under test.
Hybrid support: Yes
Support for automating vendor-provided or third-party apps: Yes
OS Support
Java 8 or up installed and configured correctly for your platform
Linda, Rogersoft Page 1
Mac, Windows, or Linux OS with the ability to run the Android SDK
Part 1
1.1 Real Device Setup
For Android automation, no additional setup is required for testing on real devices, other than
these simple requirements:
Ensure that Developer mode is turned on for the device.
Ensure that the device is connected via USB to the Appium host, and can be seen
by ADB (run adb devices to make sure).
Ensure that "Verify Apps" in settings is disabled, to allow Appium's helper apps to
function without manual intervention.
Step 1
Enabling Developer Mode Options on Android Phone
Enable `USB Debugging`: {Redmi Mobiles ---> Also Enable `USB Debugging(Security
settings)` and Allow `Install Apps via USB`}
Enable `Disable Permission Monitoring`
Step 2
Install `Google calculator` and `APK Info` applications from PlayStore
Step 3
Check connected Devices
Open cmd
Go to Location C:\sdk\platform-tools
Enter the following command > adb devices
Authorize devices by allowing RSA key generated in Mobile.
Again Enter > adb devices [to check whether its state changed to `unauthorized`
to `device`]
1.2 Windows Desktop Setup
Step 1
Either Download Appium dependencies from the shared `Google drive` or use the following
links for downloading the same.
Linda, Rogersoft Page 2
Download java 8+ - https://www.oracle.com/in/java/technologies/javase/javase-jdk8-
downloads.html
Download java-client library - http://appium.io/downloads.html
Download and Install latest version of appium - http://appium.io/downloads.html
Download platform-tools - https://developer.android.com/studio/releases/platform-
tools
Download selenium library - https://www.selenium.dev/downloads/
Download Chromedriver - https://chromedriver.chromium.org/downloads
apk signer - https://androidsdkmanager.azurewebsites.net/Buildtools
Step 2
Create sdk folder
Create a folder `sdk` in `C` Drive
Copy and paste apksigner.jar file to sdk
Unzip platform-tools folder to sdk
Step 3
Install Appium
Set ANDROID_HOME [C:\sdk]
Set JAVA_HOME [C:\Program Files\Java\jdk1.8.0_192]
enviroment variables in appium_desktop_application.
1.3 Appium Project Setup
i. Create a java project – Appium
ii. Add TestNG library to project [Right click on Project -> Build path -> Add Libraries ->
TestNG ]
iii. Create two folders in project named `lib` and `drivers`
iv. Add chromedriver.exe file to `drivers` folder
v. Add jar files to lib
a. [java-client, commons-lang3, selenium]
vi. Add jar files in lib to build path {select jar files -> Build path -> Add to Build path}
vii. Create two packages in src folder
a. package1 - hybrid_app_testscripts
i. |__Class - NewtoursTest.java
b. package2 - native_app_testscripts
i. |__Class - GoogleCalculatorTest.java
Linda, Rogersoft Page 3
Part 2
2.1 Basics of Appium
2.2 Code Explanation
Part 3
3.1 Test Execution
Open Appium Desktop Application
Click on `Start Server`
Go to Eclipse
Run the desired test
Check log in Appium
Note: After each run clear the logs in appium server.
3.2 Element Inspection
Open Appium Desktop Application
Click on `Start Server`
Click on `Magnifying glass icon`
Enter all the Desired capabilities
Click on Save as Save
Click on start session
References
https://appium.io/
Linda, Rogersoft Page 4