Appium: Some Advance Features, Key Codes and Limitations

30 / Nov / 2016 by Keshav Kashyap 0 comments


  • Appium is an unreservedly distributed open source tool used for User Interface as well as functional testing of Android and iOS mobile applications.
  • Appium permits native, hybrid and web application testing and backing automation test on physical gadgets as well as on emulator or simulator both.
  • It offers cross-platform application testing i.e. the same API works for both Android and iOS platform test script.
  • Appium supports multiple programming languages that have Selenium client libraries like- Java, PHP, Ruby, Python, C#, etc.

Basic Requirements for Appium

Eclipse should be installed in your system.

  1. iOS System Setup Requirements
    • Mac OS
    • XCode
    • Apple Developer Tools (iPhone simulator SDK)
  2. Android System Setup Requirements
    • Android SDK & Java should be installed properly.
    • Appium setup for Android as well as iOS on OS X, Linux, and Windows.
    • Define desired capabilities for writing the Appium test.

How to Define Desired Capabilities?

Desired capability are the set of keys and values that store the properties such as deviceName, browserName, platformName, platformVersion and so on.


UIAutomator is a tool used to inspect mobile elements on the mobile interface.

How to Use UIAutomator?

  • Go to SDK folder and open the tools folder.
  • Open UIAutomatorViewer.
  • On the real device, launch the app & move to the page/screen you want to automate.
  • In UIAutomator Viewer, click on Device screenshot (second button).
  • Click any element on the page and look in the Node point of interest window (there you will find details about the selected element layout in the form of resource-id, class, name, etc.)
  • Use the info found (id, class) in the test to click buttons, fill input fields, etc.

Mobile Keyboard Events Used in Mobile Automation

During mobile automation, in few cases, we have to use mobile device functionality e.g. use a Keyboard, Camera click, etc. For such functionalities, we can use Mobile Key Codes. Below are few Key Codes:

  1. Public static final int KEYCODE_ENTER
    • Key code constant: Enter key.
    • Constant Value: 66 (0x00000042)
  1. Public static final int KEYCODE_CAMERA
    • Key code consistent (Camera Key): It is used to launch a camera application in Android to take pictures
    • Constant Value: 27 (0x0000001b)
  2. Public static final int KEYCODE_BACK
    • Key code constant: Back key
    • Constant Value: 4 (0x00000004)

Common Functions Utilized in Mobile Automation

tap(), swipe(), swipe Left to Right, swipe Right to Left, swipe Horizontal, swipe Vertical, pinch(), zoom(), getNamedTextField(), isAppInstalled(), installApp(), removeApp(), launchApp(), closeApp() are some actions used in mobile automation

Common Codes for Mobile Events

Below are the snapshots of Mobile Events sample codes:

Swipe Horizontal in Mobile Automation

Swipe Horizontal in Mobile Automation

Fig. : Swipe Horizontal

Swipe Vertical in Mobile Automation

Swipe Vertical in Mobile Automation

Fig. : Swipe Vertical

Swipe Right to Left in Mobile Automation

Swipe Right to Left in Mobile Automation

Fig. : Swipe Right to Left

Swipe Left to Right in Mobile Automation

Swipe Left to Right in Mobile Automation

Fig. : Swipe Left to Right

Common Issues of Appium

Error 1: The following desired capabilities are a must, however these are not given: deviceName, platformName

Solution: Add missing desired capabilities e.g. device Name, platformName in the Appium script.

e.g.: capabilities.setCapability (“deviceName”,”Emulator”); capabilities.setCapability (“platformName”,”Android”);

Error 2: Couldn’t discover adb. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.

Solution: You have to set up SDK root directory path in system ‘Environment Variables’ as ANDROID_HOME variable and provide Platform tools and Tools in ‘Path’ column.

Error 3: org.openqa.selenium.SessionNotCreatedException: Another session could not be created.

Solution: You have to provide correct App path and restart the Appium server.

Advantages of Appium

  1. It’s an open source tool.
  2. Support for both stages Android as well as iOS.
  3. Handles simulators/emulators and real devices.
  4. Underpins automation of Hybrid, Native and Webapps.
  5. Underpins the vast majority of the programming languages like Java, Ruby, Python, C#, etc.

Competitors of Appium

Some of the contenders of Appium are Ranorex, Robotium, SeeTest, Test Complete, Jamo Solutions.

Appium vs. Robotium

Appium is a cross platform tool which means you can write or run the script for iOS and Android while Robotium supports the Android platform.

Appium supports multiple languages such as JAVA, C#, JavaScript, Python, Ruby, etc. whereas Robotium support only JAVA.

Appium can be used for mobile web, native and hybrid mobile applications. But Robotium can be used only for native and hybrid mobile applications for Android.

Appium vs. Selendroid

Appium supports all Android API levels having one limitation. As it uses UIAutomator for tests running on API>=17, for older API’s we need to run tests utilizing Selendroid.

Selendroid, a test automation framework which is utilized ONLY for Android apps. Whereas Appium is an open source automation tool used for Android, iOS, and Firefox OS too.

Selendroid has different Android target API support (10 to 19) and it has no confinement with Web-view testing like Appium which utilises UIAutomator for API>=17.


Well, that marks the end of our Appium blog. So we can conclude that Appium is the best mobile automation testing tool which is effectively accessible and everyone should utilize this tool for mobile automation testing.


Leave a Reply

Your email address will not be published. Required fields are marked *