Thursday, November 2, 2017

Steps to Automate LinkedIn Android app[Package+activity+capabilities]

1) install Appium + Node

2) Install Android Studio as well and create a virtual device on that i have created with name : Nexus_5X_API_25_1

3) Download LinkedIn.apk file from below link.

4) Now For automating any android app we need to know the package and activity names.
So Lets find them.

For this set your PATH variable to point to below directories.

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/build-tools/26.0.2

above version can be anything in my case it is 26.0.2

after setting the above path variables run the below command.

aapt dump badging “<Path to LinkedIn.apk>” 

Output of above command will contain below 2 values.

package: name=''
launchable-activity: name=‘'

5) So we got the package name and activity name too. Now we should frame the desired capabilities section. Like this(In my machine)

  "platformName": "Android",
  "deviceName": "Android Emulator",
  "app": "/Users/sriramkukkadapu/Downloads/LinkedIn.apk",
  "automationName": "Appium",
  "platformVersion": "7.1.1",
  "appPackage": "",
  "appActivity": "",
  "avd": "Nexus_5X_API_25_1”

6) Now start appium with above capabilities and you can see it will open the app :)

Assuming my appium/node server is running on url :
You can check the status of the server with this url

Note: IP and the port number values would be the one which we give, when we start the node/appium server


public class AndroidDriverEx {
public static void main(String args[]) throws IOException, InterruptedException
    WebDriver driver=null;
    DesiredCapabilities capabilities = new DesiredCapabilities();
    capabilities.setCapability("deviceName","Android Emulator");
    capabilities.setCapability("app", "/Users/sriramkukkadapu/Downloads/LinkedIn.apk");
    driver=new AndroidDriver(new URL(""), capabilities);

Now we are good to go and automate all the actions which you wanted to automate.

1 comment:

  1. Hello,
    This is a great post. So clear and easy to follow. Thanks for the tangible and attainable help. All your hard work is much appreciated. Appium Training