How to Use the Appium Inspector

Reading Time : 7min read
How to Use the Appium Inspector

How to Use the Appium Inspector

Navigating the intricate landscape of mobile app testing requires adept tools, and among them, Appium Inspector stands out as a pivotal force. In this post, we dig into the capabilities and nuances of Appium Inspector, shedding light on how to use this indispensable tool for enhanced mobile app testing experiences. 

eBook

Introduction to Appium Inspector 

As you may know, inspectors are tools that allow engineers to confirm the proper operation of mobile app elements; today, the most common element inspectors are:

  • Chrome and Safari Dev Tools
  • Appium Inspector
  • UiAutomatorViewer (Android)
  • XCUiTest including Accessibility Inspector (iOS)

To get the most out of each inspector tool, it’s important to understand the value of experienced advisors. Fortunately, Kobiton prides itself on not only project assistance, but on offering expert guidance as well — for all tools and processes.

Tools for both web and mobile app inspection

UI Automator for Android

UI Automator is a framework for functional testing across both system and installed applications for Android specifically; its APIs allow engineers to interact with a number of device elements. Interested in checking out a UI component by pulling up text or content descriptors? UI Automator allows you to do just that. UI Automator’s framework is ideal for writing general automated tests, where test code might not rely on internal implementation detail.

Please note, however, that UiAutomater requires Android 4.3 (API level 18) or higher.

XCUiTest for iOS

Much like UI Automator is to Android, XCUiTest is for iOS. There are three primary ways to find screen elements when utilizing  XCUITest (for iOS systems): UI Test Recorder, which is great if you’re just getting started; Accessibility Inspector, a practical choice if the app is up and running; and po (for debugging) — which allows you not only find elements, but interact with them as well.

Appium Inspector for Web and Android/iOS Mobile Devices

As you can see, there are excellent, platform-specific inspector tools and frameworks for each respective platform. However, this is extremely difficult to scale when you have a web, hybrid, and/or native mobile application that needs to be able to run on all platforms. For mobile specifically, that is two separate ecosystems to set up, configure, inspect, create, and execute: one for Android and one for iOS. To solve this platform fragmentation, the folks over at Selenium, who pioneered web automation, created Appium for mobile and thus Appium Inspector. 

What is Appium?

Appium is an open-source, mobile automation testing framework, one supporting multiple programming languages. The main objective of Appium is to combat device/ platform fragmentation when automating for both Android and iOS apps.

As mentioned above, Appium is part of what’s called the Selenium WebDriver family; it utilizes Selenium WebDriver API that specifies a client-server protocol with vendor-provided frameworks under the hood: UiAutomator and XCUiTest. There’s no need to compile a third-party framework or code, and engineers can deploy the same app you have tested across cross-platform devices with assurance.

One of the really cool things about Appium is that it also includes an Appium Inspector utility, which allows developers and automation engineers to inspect a mobile app’s UI for both Android and iOS devices. 

In the app development ecosystem, Appium Inspector is a valuable and important tool that can ultimately allow engineers to streamline many components of the testing process.

To learn more, snag our free eBook, Make the Move to Automation With Appium.

What is Appium Inspector?

Much like the platform specific inspectors mentioned above, Appium Inspector is a tool that allows automation engineers to inspect both Android and iOS application’s DOM (Document Object Model), but in one ecosystem. It is powered by Appium’s server, which is installed on one’s computer, and is connected to a mobile device or emulator/simulator. To put it simply, Appium Inspector is one of the many Appium clients (such as Java, Python, and WebdriverIO) that helps facilitate mobile application automation. A UI allows engineers to select which Appium server will be utilized; once a session has begun, element interaction and inspection can begin.

Advantages and Benefits

In the context of mobile app testing, Appium Inspector’s greatest advantages are an ability to identify and interact with mobile app elements, simplified script creation, and debugging prowess. Appium Inspector capabilities are created with developers and automation engineers in mind — and that’s why it’s such a great resource.

There are also limitations that should be kept in mind when utilizing Appium. As I’ve already shared, it doesn’t allow testing for Android app versions below 4.2. Appium also offers very little support for testing hybrid apps. Interested in testing actions that allow you to switch apps, from native to web, or the other way around? You can’t do that here. Additionally, you won’t find any support on the topic of running Appium desktop inspector on Windows directly. Lastly, some platform-specific locators are lost/not inspectable in Appium that otherwise would be used in the native frameworks.

Getting Started with Appium Inspector

Find Elements (iOS and Android)

Fortunately, Appium makes it easy to use the locator to find an element; simply find the “Search for Elements” icon, which will provide a list of locators that can be used with Selenium. Locator strategies can be an “ID,” “XPath,” or “Name.”

  • Find element by ID
  • Find element by ClassName
  • Find element by Accessibility ID
  • Find element by Resource ID
  • Find element by XPath

After connecting Appium Inspector to the Appium server, select the emulator or device that you’ll be inspecting. Utilize Appium Inspector to click on elements, view element locators — and even take screenshots!

And, it’s always a great idea to brush up on Appium element locator strategies.

Android

AttributeLocator Strategy (Android)
textName
resource-idId
classClass Name
content-descAccessibility Id

iOS

AttributeLocator Strategy (iOS)
nameName, Id
labelId
typeClass Name
accessibility idAccessibility Id

Setting up Appium Inspector

Once you become familiar, Appium Inspector is fairly easy to work with:

  1. First, start the Appium server.
Image of appium server
  1. Next, open Appium Inspector and connect to Appium’s server.
image of connecting to appium's server

Click on the Search button and open the Appium Inspector Session.

image of emulator or device to inspect
  1. Then, simply select whichever emulator or device that you’d like to inspect.
    1. You may connect to an emulator, simulator, local device connected, or through a cloud provider, such as Kobiton. When connecting to a cloud provider, simply input the cloud server URL along with your username and password/API key
  2. When you have the device specified in the desiredCap (desired capabilities) along with the App defined, Appium Inspector will now display your emulator or mobile device screen. For Kobiton devices and apps, you may define the device specifically with UDID, or set desiredCaps with device name, platform name, platform version, etc. along with the specific app ID.
Image of desiredCap screen
  1. Appium Inspector allows you to interact with elements, view element locators, and even collect screenshots.
Image of appium inspector features

Kobiton is Here to Help

Ready to take the next steps? Now that I’ve explained how to use Appium Inspector – and we’ve considered some of the many Appium Inspector capabilities – it should be clear that Appium is preferred by so many industry professionals for a good reason.

That said, teams should always choose the framework that best suits their needs; we can help clients with Appium, Espresso, and XCTest / XCUITest frameworks. At Kobiton, we’re able to assist you in making the most of resources, streamlining your mobile app development process and delivering quality results in a snap.

Email us today to get started.