Blogs | Srijan

Tutorial: Inspect your Mobile Apps with Appium Desktop & Macaca Inspector

Written by Komal Batra | Apr 26, 2019 7:00:00 AM

A high-quality and robust app can be produced only with regression testing. Mobile Test Automation increases test efficiency, effectiveness while also enabling faster time-to-market for apps.

While there are various test automation frameworks and tools like Monkey Talk, Robotium, Selendroid, Appium Desktop, UIAutomator, Testdroid etc. to execute test automation effectively and conveniently, we will discuss Appium Desktop and Macaca Inspector.

One of the most significant tests automation frameworks, Appium provides a graphical frontend and inspect applications through Appium Desktops.

In simpler words, Appium Desktop is a graphical interface for starting an Appium server and inspecting the app's structure via Appium. While Macaca is an open-source automation test solution for native, hybrid, mobile web and web application on mobile and desktop platforms.

Here’s a step-by-step guide to inspect mobile applications using Appium Desktop Inspector and Macaca Inspector.

Getting Started

Using Appium Desktop

To write mobile automation scripts with Appium, we need to, first, run Appium Server and also a mechanism to identify the controls/elements of the mobile app which we want to automate.

Considering Appium with global packages is already installed, one of the ways to launch the Appium server is via  Appium Desktop.

To start the server, simply click on Start Server Button.  

After the server has been started, Inspector option is displayed using which we can get the properties of the elements in mobile application

  1. Start your inspector session with Appium Desktop Inspector by clicking on the search icon.

 2. After the inspector session is launched, you will see the following view on your screen.

You can, now, inspect by creating a new session.

   a) Click on ‘Desired Capabilities’ tab
   b) Input the necessary desired capabilities in ‘JSON representation’ tab.

    3.Click on the ‘Start Session’

       After this, the simulator with the configuration as (stated in desired capabilities)  will be                             launched and the app will be installed. You can access the path through app desired capability.

 Inspect with Existing Session

         If we already have an Appium script.

              a. Run Your Existing Appium Script and your session id will be generated.

              b. As we click on the inspector icon, current session id will be displayed automatically in the                       text box as shown in the screenshot below.

          c. Next, click on ‘Attach to the Session’ tab to attach the current session with the appium                            inspector.

Simulator with the configuration as stated in the script or in desired capabilities will be launched along with the appium desktop inspector view.

And Appium Desktop Inspector View will be displayed that contains the

    1. The App View of the application
    2. The App source / DOM
    3.  Properties of the selected element

Click an element in the app view whose locator we want to know, it automatically selects the element in the Source and the properties of that element are displayed on the right side.

The properties include the selectors - xpath , class , id , name etc.

Inspecting Mobile Elements Using Macaca Inspector 

Install Application Inspector with  

$ npm i app-inspector -g

Launch from the cli with

$ app-inspector -u YOUR-DEVICE-ID

YOUR-DEVICE-ID is the udid of the device in case of IOS. For Android, simply launch your device first, then use adb to list all your devices.

$ adb devices

After the $ app-inspector -u YOUR-DEVICE-ID command is run then open the following link http://192.168.10.100:5678 in your browser.

Now Macaca App Inspector displays the view as shown below.

Simply Click on the element in the app view and see the DOM/Source in the next panel and the properties on the right side of the selected element.

Done!

And that’s how you can inspect mobile application elements in easy steps. You can use it in your appium scripts for automation of mobile application.

We provide unified Test Automation Framework and tools to enable easy automation for you. Not only it saves up your many hours, but it reduces the operating cost too.

Get in touch with our experts at business@srijan.net to know more about high-quality test automation solutions.