Fiddling with Appium Desktop – initial learning and gotchas

What is Appium Desktop ?

Launched about an year ago, Appium desktop is a desktop app that provides a GUI to run the Appium server and (much more importantly) offers a GUI capability to inspect apps under test (locally and remotely)

Through this post I will share my experience with

  • Appium desktop installation and launch
  • Connecting a physical device with Appium desktop and inspecting the app under test

Appium Desktop install process ::

  1. Install the Android SDK as part of the Android Studio IDE ( https://developer.android.com/studio/index.html) I chose that option because I wan to play with Android studio as well. You dont have to , so for Appium’s purposes you just need the Android SDK
  2. Get the latest release for the Appium Desktop installer here –> https://github.com/appium/appium-desktop/releases/tag/v1.5.0
  3. Download, install and click the shortcut to launch Appium Desktop, you should get a screen similar to this

Starting Appium server

  1. Click on the “Start Server..” button above ( I kept the Host and Port default)
  2. And see you should the console screen below

Note a wee gotcha here, that the app “transforms”into the console window here ( in case you are looking for the app and console to exist as two windows, as i was 🙂 )

Connecting to your device

There are two aspects to this –

a) Configuring and connecting your physical device

b) Configuring Appium Desktop ( primarily through setting up capabilities , some pre-reading for that here –> https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md )

For configuring my device, I had mainly set up USB debugging ony my Android device under settings ( I learnt quite a it from this beginner Android Studio tutorial here  )

Next step is now to get Appium Desktop to talk to your device and this process had a few gotchas that I have shared solutions for below

  1. Start a session in Appium Desktop , from the console window above click “File”–> “New session”
  2. The new session part of Appium Desktop should be displayed below

For this post I am only going to focus on the “automatic server”option .

To be able to connect to the device, I had to set some capabilities but had no idea what was the exhaustive list of capabilities to be set.

So, I started out with a minimal list of

{
  "platformName": "Android",
  "platformVersion": "7.0",
  "deviceName": "HUAWEI EVA-L09"
}

See the screenshot below on how to set them up in Appium Desktop 

Note –   You have to find your Android version and phone name . Some basic googling  should be solve that for you

With those capabilities set and the device conected, I clicked Start session to see what happens

Gotcha :: An error popped up re: ANDROID_HOME not being set  – 

 

 

Ok, weird I was expecting this to be set up as part of installing the Android SDK as part of Android Studio IDE, but no, I am too demanding 🙂

To fix this –

  1. Find where your Android SDK directory is ( Googling told me that it is usually @ C:\Users\<user-name>\AppData\Local\Android\Sdk )
  2. Add that to that value to a new environment variable ANDROID_HOME

 

Lets try again ….

Gotchas :: Some more capabilities need to be set ! 🙁 

Ok, part of it I can understand i.e. I had completed missed setting a target app that needs to be controlled through Appium

and part that I have no idea about i.e. “app package”

Solving :: installing a target app and setting that capability

  1. Install and download the apk for the app you want tested through Appium. I used this app from the official Appium tutorials page — https://github.com/appium/sample-code/tree/master/sample-code/apps/ApiDemos/bin
  2. For finding the app pacakage capability, I did some further googling and stumbled upon this very useful tutorial — https://www.youtube.com/watch?v=RDjNPnuyA00  .
  3. I used method 3 from the above tutorial ( as I was not using CLI for the purposes of this learning exercise). Important to note that the tutorial advices ( contrary to the error message ) that I would need both the appPackage and appActvity parameters for this to work

Based on the three steps above I set this following capability in Appium desktop

So, now the capabilities JSOn snippet looked like this

{
  "platformName": "Android",
  "platformVersion": "7.0",
  "deviceName": "HUAWEI EVA-L09",
  "appPackage": "io.appium.android.apis",
  "appActivity": ".ApiDemos"
}

Click Start session one more time and see if works ?

Yooooooodley...... no error messages this time and now I can see a new screen
 on Appium Desktop that shows a mirror of my phone with the app on it and 
information on the app's elements etc 


Now , I am all set to inspect and interact with the app under test using 
Appium Desktop and writing tests in Python ! :)

 

One thought on “Fiddling with Appium Desktop – initial learning and gotchas

Leave a Reply