
Accessibility Inspector and UIAutomatorViewer
Frank Moyer
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.
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:
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.
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.
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.
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.
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.
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.
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.
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.”
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
Attribute | Locator Strategy (Android) |
text | Name |
resource-id | Id |
class | Class Name |
content-desc | Accessibility Id |
iOS
Attribute | Locator Strategy (iOS) |
name | Name, Id |
label | Id |
type | Class Name |
accessibility id | Accessibility Id |
Once you become familiar, Appium Inspector is fairly easy to work with:
Click on the Search button and open the Appium Inspector Session.
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.