Object Spy and Searching XPath in Appium Inspector

You are here:
< All Topics




Object Spy:

Appium Inspector, equipped with the Object Spy tool, serves as a powerful aid for mobile application testing. The Object Spy functionality allows testers and developers to examine the properties of user interface elements within the app. It provides insights into attributes such as ID, name, class, and accessibility identifiers, enabling a comprehensive understanding of the app’s structure.

With Object Spy, users can interactively explore the app’s elements during runtime. This proves invaluable for creating robust and reliable test scripts, as it ensures the precise identification of UI components.


Searching XPath:

XPath, a powerful querying language, is extensively used in Appium for locating elements on a mobile app. The process involves crafting XPath expressions to pinpoint specific elements accurately. Appium Inspector simplifies this task by providing a user-friendly environment for searching and validating XPath expressions.

Testers can leverage the search functionality to dynamically locate elements, enhancing the resilience of their automation scripts. Additionally, Appium Inspector facilitates the highlighting of elements, allowing users to visually confirm the accuracy of their XPath queries. This feature significantly streamlines the element identification process, contributing to more efficient and reliable mobile app testing.

In essence, the combination of Object Spy and XPath searching in Appium Inspector empowers testers to build robust automation scripts by providing insights into the app’s structure and simplifying the element identification process.


Step 1: Login with valid credentials to your TestGrid account. Navigate to the Real Device Cloud screen and connect any devices, as shown below.


Step 2: Open your app and locate the left-side screen Inspector option, as demonstrated in the screenshot below.



Step 3: Open any element by clicking on it in the element inspector. Once clicked, locate and click the Details button in the element inspector page below to view all the details related to that element, as shown in the screenshot below.



Step 4: Utilize the details provided to create an XPath. In this case, the XPath format will be { //android.widget.TextView[@text=’YouTube’] } or either full xpath.

Copy this XPath and search for it in the upper part of the element inspector, as shown in the screenshot below. The elements corresponding to the XPath will be highlighted in yellow.


For Object Spy:


Step 5: Another crucial feature available is the Object Spy, which allows you to highlight elements in yellow when clicked within the app on the real device.

To enable Object Spy, go to the inspector page in the upper part and activate it. Now, you can click anywhere within the app to see the corresponding elements highlighted in yellow. Please check, as shown in the screenshot below.





Happy Testing!!!!

Table of Contents