How to connect android applications with Appium Inspector

Introduction: 

Appium is a popular open-source tool that automates native and hybrid mobile applications. The Appium inspector tool is used for task management purposes such as script recording and element discovery. This tool also serves as the standard procedure for identifying mobile application elements. Appium Inspector is a handy tool for QA engineers who want to automate mobile applications. It demonstrates the mobile application elements and different components/layers of the application, making it the best choice for automation. Let’s look further into the architecture of this tool: 

Appium inspector architecture: 

Finding unique elements during mobile automation is extremely challenging. However, the Appium inspector simplifies this complex task through four simple steps. These steps are: 

1. Setting up the Appium Inspector UI Application:  

  • Open the Appium desktop application on your computer. 

2. Activating the Appium server:  

3. Enter the desired capabilities under the Appium inspector and start the session. 

4. Inspecting the element:  

  • Once you have completed the above steps, the application will launch under the emulator/mobile device, allowing you to inspect the elements under the Appium Inspector. 

image001

Appium inspector configurations: 

In contrast to the other costly licensed tools, you can record and playback the mobile applications using the open-sourced Appium inspector. QA engineers can directly perform any actions on the application and generate the test scripts by inspecting DOM in any desired language. 

Setting up a real device/emulator: 

An emulator is a virtual android or IOS device that can be configured or demolished within the system. You can also connect the Appium inspector with your actual device. Let’s now look at how we can prepare an emulator/physical device to communicate with the Appium inspector. 

  • Activate the emulator on your device or physically connect the device with a PC using a USB 
  • Go to the mobile/emulator settings and click on the about phone. 
  • Click on the android build number to enable the developer mode. the 
  • Dig into the developer option and turn on the USB Debugging. 
  • Turn on the USB debugging option from under the Developer options menu. 

image003

Setting up desired capabilities 

Once you launch the Appium inspector, the following screen will appear:

image005

What are the desired capabilities? 

The term desired capabilities is used to specify the test environment.  

It can be a web browser, mobile device, mobile emulator, mobile simulator, etc. You can set up mobile platforms, mobile devices, and versions using the desired capabilities. Let’s now move on to learn what are the most common desired capabilities for the test environment. 

Most wanted desired capabilities: 

Device name: 

This demonstrates the Android or IOS emulator/device name and takes the capability as ‘Text’. Here is an example:  

  • Capability Name: appium:deviceName 
  • Capability type: text 
  • Capability Value: XYZ_Device

image007

Platform name: 

The platform name determines the Android or IOS name and takes the capability as ‘Text’. Here is an example of how you can set it: 

  • Capability Name: appium:platformName 
  • Capability type: text 
  • Capability Value: android/IOS

image009

Application package: 

This demonstrates the desired application package that needs to be automated and takes the capability ‘Text’. Here is an example of how you can set it: 

  • Capability Name: appium:appPackage 
  • Capability type: text 
  • Capability Value: com.google.android.apps.messaging

image011

Application activity: 

This reveals the desired application activity that is required to be automated, and it takes the capability ‘Text’. Here is an example of how you can set it: 

  • Capability Name: appium:appActivity 
  • Capability type: text 
  • Capability Value: com.google.android.apps.messaging.ui.ConversationListActivity

image013

How do we get the application package and activity? 

  1. Open the command prompt on your PC.
  2. You need to make sure the active emulator is in running condition on your PC. 
  3. Enter the command ”adb devices” 
  4. The system is going to display a list of all active devices. 
  5. Make sure the emulator name is displayed under that list. 
  6. Navigate to the emulator and open the desired application. 
  7. On the same time run command under the command prompt “adb shell dumpsys window | find “mCurrentFocus”” 
  8. The system will return the output in form of the following “mCurrentFocus=Window{90b473f u0 com.whatsapp/com.whatsapp.registration.EULA}”

image015

     9. The application package would be “com.whatsapp” from the output mentioned above. 

    10. The application activity would be “com.whatsapp.registration.EULA” from the output mentioned above. 

No reset: 

The “no reset” option restricts the running application from clearing or stopping the application data and takes the capability ‘boolean”. Here is an example of how you can set it: 

  • Capability Name: appium:noReset 
  • Capability type: boolean 
  • Capability Value: true

image017

Conclusion: 

Hopefully, by reading this, you now have an abstract understanding of the Appium inspector and are ready to link any mobile application with the Appium inspector. If you want to learn more about the Appium or schedule a demonstration, please visit www.alphabold.com  or contact us at [email protected]

Leave a Reply

Your email address will not be published.