Launching any application using Appium

Table of contents
Reading Time: 2 minutes

In the last blog we learned how to identify different elements using Appium ( . In this blog we will see how we can launch any application using Appium.

It is not always possible to get the APK of the application that you want to test using Appium. For example, if we want to test any system application such as the messages app of any mobile device. You will not be able to get the APK for them. So to launch and test these applications we can you Appium.

To launch the application we need to define two desired capabilities, appPackage, and appActivity. For getting these desired capabilities we require to connect our device to the system or to launch our emulator on our local system.

  • Open the terminal and execute the command:
adb devices
  • This will show you all the devices connected to your local system. It can be emulator or a real device.
  • Execute the command to enter into the device on which the applications is installed.
adb shell
  • Now go to your mobile device and open the application for which you want to get the appActivity and appPackage. The application should be in focus for the commands to work.
  • Execute the command to get the details of the focused app.
dumpsys window windows | grep -E mCurrentFocus
  • The first line ( before the / is the appPackage and the line after that ( is the appActivity.
  • After we get the apppackage and appActivity we can use them in our desired capabilities file.
DesiredCapabilities capability = new DesiredCapabilities();
        capability.setCapability("deviceName", "Pixel_API_28");
        capability.setCapability("platformVersion", "9");
        capability.setCapability("platformName", "Android");

This was a short blog on how to launch applications without using the APK for the application.


Written by 

Ankur is a Sr. QA Consultant having experience of more than 3 years. He is familiar with the core concepts of manual and automation, postman and Newman are his expertise. He is always eager to learn new and advanced concepts in order to expand his horizon and apply them in project development with his existing knowledge. His hobbies include watching web series and getting to know about all the latest gadgets that come in the market.