How to Use the Appium Inspector

Reading Time : < 1min read
How to Use the Appium Inspector

How to Use the Appium Inspector

Navigating the intricate landscape of mobile app testing requires a discerning eye and adept tools. Among those tools, Appium Inspector stands out as a pivotal force. If you find yourself wondering how to use Appium Inspector, worry not. Let’s dig into the nuances of how to use Appium Inspector for enhanced mobile app testing experiences. 

Introduction to Appium Inspector 

Inspector tools allow engineers to confirm the proper operation of mobile app elements. The most common element inspectors in use today 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.

What is Appium and What Does it do?

Appium is an open-source mobile automation testing framework that supports multiple programming languages. Appium’s use case is to combat device/ platform fragmentation when automating for both Android and iOS apps.

Like the element inspectors listed above, Appium Inspector allows automation engineers to inspect both Android and iOS application’s DOM (Document Object Model) in one ecosystem. It connects to a mobile device or emulator/simulator via your computer. You just have to download the Appium desktop inspector. 

What is Appium Inspector and What is its Purpose?

One of the best features of Appium is the Appium Inspector utility. Developers and automation engineers can inspect a mobile app’s UI for both Android and iOS devices. Similarly to other Appium clients like Python or Java, Appium Inspector helps facilitate mobile application automation. Engineers just select which Appium server to utilize via the UI and begin element interaction and inspection after starting a new session.

Snag our free eBook Make the Move to Automation With Appium to learn more about it.

Appium vs. UI Automator vs. XCUiTest

UI Automator is a framework for functional testing across both system and installed applications for Android specifically. The tool’s APIs allow engineers to interact with several device elements. UI Automator allows you to do things like check out a UI component by pulling up text or content descriptors. The framework is ideal for writing general automated tests where test code might not rely on internal implementation detail. However, UI Automater requires Android 4.3 (API level 18) or higher.

Comparatively, XCUiTest – Apple’s official integrated development environment (IDE) – is a similar tool for iOS devices. It offers three primary ways to find screen elements when utilizing  XCUITest including a UI Test Recorder for beginning stages, the Accessibility Inspector for running apps, and po for debugging. This allows you not only to find elements but to interact with them, as well.

What are the Differences Between Appium and Appium Studio?

As mentioned, Appium is an open-source mobile automation framework that provides diverse programming language and platform support options. Appium Studio, an IDE created by Experitest, delivers additional features such as a better GUI and enhanced device management. However, it is a commercial extension more suited to large-scale, enterprise-level deployments.

When do I use Appium Inspector?

This tool comes most in handy for situations including:

  • Automation Script Creation
  • XPath Expression Generation
  • Element Identification 
  • Cross-platform Testing 
  • Finding Element Attributes
  • Debugging/Troubleshooting
  • Record and Playback Testing

Key Features of Appium Inspector

The main focus of Appium Inspector is to provide a visual framework that lets developers better inspect and create automation scripts for mobile apps. Additionally, that visual framework lets testers interact with elements in the application and even inspect their properties. It can also record interactions with the app to generate test cases automatically.

Element Identification & Attribute Verification

Appium Inspector’s graphical user interface (GUI) facilitates easier identification of elements like images, test fields, and buttons for accurate automation script development. Users can verify element attributes and properties like text, color, size, and position to ensure the correctness and consistency of UI elements across different devices and platforms.

Script Creation

Simplify the process of creating automation scripts for mobile apps with the Appium Inspector. Appium offers clients for Ruby, Java, Python, java scripts, and more to enhance efficiency in test script development. You can also reuse code for different platforms. The visual interface and deep programming language support streamlines script creation.

Debugging Capabilities

By inspecting elements and properties, the Appium Inspector tool can help developers debug test automation scripts. The tool offers robust debugging features like text logs, video recording and device logs, screenshots for failed tests, and more.

XPath and Accessibility ID Generation

Developers can get tools from Appium Inspector to help generate XPath expressions and to use Accessibility IDs for element identification. This empowers automation script stability and accurate element targeting.

Getting Started with Appium Inspector

The first step with any program is to install it first. For Appium Inspector, this involves first installing Appium and then both Appium Desktop and the Appium server.

Screenshot of starting an appium server

1. Start Appium Server

You’ll need to open a terminal window or command prompt and type “appium” to open the Appium tool.

2: Connect to Appium’s Server

For a simple connection, verify that the Remote Host is set to 127.0.0.1 and the Remote Port is set to 4723. Then, click “startServer” and the Appium server will start running on your device. An advanced option would include a specific address and port. Preset lets you access previous server locations more quickly using saved information.

3. Set Desired Capabilities

In Appium, Capabilities can be set via the GUI or provided through client programming. These reflect the device on which we are conducting tests. An example of this can be found below with some possible capability values listed. Others include orientation, browser name, language, platform Version, etc. Saving your desired capabilities is highly recommended – especially when testing multiple apps or using multiple devices. Once you have saved this, you can access it directly via “Saved Capabilities Set”.

platformNametextAndroid
deviceNametextemulator-1234
apptextD:/Projects/appium-kobiton
automationNametextUiAutomator2

4. Start New Session

Clicking “Start Session” will do just what it says: initiate a connection between your mobile device or emulator and the Appium Inspector.

Inspect Elements

Fortunately, Appium makes it easy to use the locator to find an element. Simply find the “Search for Elements” icon; it 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!

Screenshot of inspection

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

Limitations of Appium Inspector

In the context of mobile app testing, Appium Inspector’s greatest advantages are its 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. However, as with all things, there are known issues and limitations. These include things like:

  1. It lacks support for hybrid app testing.
  2. It requires basic programming knowledge.
  3. Appium desktop inspector is not directly supported on Microsoft Windows.
  4. It doesn’t accommodate Android app testing prior to Version 4.2.
  5. Currently, Appium does not heavily leverage machine learning or AI for automation.
  6. Testing can be a bit slower vs. other frameworks.
  7. Appium is community-supported, so there isn’t a direct line for problem-solving and troubleshooting.

Using Appium Inspector on Windows OS

Though it is not an out-of-the-box feature, Appium Inspector does work on Microsoft Windows. But you have to make sure you have the Appium server desktop downloaded before you get the Appium Inspector download. After installation, you can launch the program and start a server.

Is Appium Inspector Compatible with Cloud-based Testing Services?

The short answer is yes – including Kobiton. However, Appium Inspector does not have full compatibility and can remove cloud providers at any time if they no longer function properly with the tool. Here is a full list of supported cloud-based testing services for Appium:

  • Kobiton
  • Lambdatest
  • Headspin
  • SauceLabs
  • BrowserStack
  • TestingBot
  • Perfecto
  • RemoteTestKit
  • Mobitru
  • Experitest
  • Pcloudy by opkey
  • RobotQA.com
  • Smartbear BitBar

Best Practices for Appium Inspector

In order to get the most out of this open-source tool, there are a few suggestions and guidelines. For starters, Appium does require some familiarity with programming; it isn’t something that any person with no experience can pick up and learn immediately. Despite this, there are many ways to leverage the tool’s power for your own ventures.

Inspecting Elements

Take advantage of Appium Inspector’s feature to view detailed properties and attributes of identified elements (such as resource IDs and class names) to create reliable and robust automation scripts. The GUI also makes it easier for users to identify, inspect, and verify elements. You can even select individual elements in an app by simply clicking on them while in Appium Inspector.

Creating Test Scripts

Leverage Appium Inspector’s code generation capabilities to accelerate script creation by automatically generating code snippets based on interactions with the app’s UI elements. This can be especially helpful for those new to automation or even programming.

Setting Automated Tests

Test automation reduces error occurrences, increases test speeds, and reduces labor costs. Running test scripts in parallel across many different configurations allows for more agile development and, in general, more high-quality and robust test scripts.

XPath and Accessibility ID Generation

Use tools within Appium Inspector for generating XPath expressions and utilizing Accessibility IDs for precise element identification, ensuring stable targeting of elements in automation scripts.

Advanced Techniques and Tips

The GUI for Appium enhances many tasks for both a developer and QA tester. But that’s not all that this tool has to offer its users. For the more experienced out there, try these advanced tips when trying to develop a test automation framework or use new locator strategies.

Use Page Object Model (POM)

As applications evolve, they require more complex updates. Removing outdated elements in this process can also prove time-intensive. Using Page Object Model (POM) allows tests to communicate with a page’s UI so that only the code on the page object has to be altered if the UI changes. The tests do not need to be changed. Thus, only the code in the page object will be updated without rewriting across test scripts. POM design patterns organize your automation code effectively to make it more maintainable and scalable.

Dynamic Element Identification

Utilize dynamic element identification techniques like XPath, CSS selectors, or accessibility IDs. For example, with XPath locators, there is absolute vs. relative or a specific path to an element vs. one that starts with the desired element instead of the root element. Relative XPath should be the better option as you can better locate elements that may change dynamically, ensuring robust test scripts that are less prone to failures.

Cross-Platform Testing

The unified interface in the Appium Inspector simplifies element inspection and interaction, as well as the testing process for apps that run on multiple platforms (like iOS and Android). You can reuse test code across devices since Appium supports most programming languages and testing frameworks. 

Parameterization

Parameterize your test scripts to make them more flexible and reusable across different test scenarios. This process entails adding specific parameters to a test case and executing a test case with different sets of parameters. You can reduce repetitive work while reaping the benefits of more robust testing.

Mastering Appium Inspector with Kobiton

Appium Inspector offers many capabilities worth leveraging and it is clear why Appium is preferred by so many industry professionals. It is great for people with programming knowledge who need that little bit extra to help them be more efficient. However, teams should always choose the framework that best suits their needs.

Our clients run the testing tool gamut using Appium, Espresso, and XCTest / XCUITest frameworks. At Kobiton, we’re able to assist you in making the most of resources and streamlining your mobile app development process to deliver quality results in a snap. Try Kobiton today with a free trial and get:

  • 300 minutes of manual testing on real devices
  • 5 Appium script generation
  • Powerful Session Explorer to analyze test results
Free Trial CTA