Use Object Spy to find objects on the device screen

Perfecto’s Object Spy supports the creation process of your test automation by providing information about object locators/identifiers. It is seamlessly operated, with no need for any external tool support.

Object Spy provides a quick snapshot of your native app, hybrid app, or website. It lets you explore objects on the device screen and view them in the Object tree pane. 

Important: When you use Object Spy on a virtual device, the following items are not available:
  • Dom view (available for real devices on non-native apps only)

  • Smart locators (because the Native tree for virtual devices is aligned with pure Appium)

The object tree presents a hierarchical view of all objects retrieved from the webpage or app. You can either select an object on the device screen or in the tree hierarchy to view related information in the adjacent Properties pane, which displays a wide range of object parameters. In particular, it lists the following properties:

  • Smart locator (formerly referred to as object locator) (not available for virtual devices)
  • Xpath
  • X and Y coordinates
  • Height and width
  • Resource ID
  • Package
  • Origin class
  • Class

For boolean properties, the pane provides information on whether they are turned on (indicated by a green checkmark ) or off (indicated by the general prohibition sign ). 

You can instantly copy the required path or property to the clipboard to embed it in your automated tests. 

In addition, Object Spy lets you:

  • Filter the tree by the following object types: buttons, edit fields, images, links, texts, and other objects. This is helpful when the tree is long and complex and you want to focus on specific objects.

    Important: When a filter is applied, the object tree reverts to a flat view. A hierarchical view is only available when all objects are displayed. In addition, selecting an object on the device screen does not bring up any object in the tree if the selected element is hidden by the filter.
  • Search the tree by any object property. If the search brings up results, the number of objects found is displayed below the search field, and you can use the < Prev and Next > buttons to browse through the results and see them highlighted in the Properties pane on the right. 
  • Validate object locators to make sure they are strong. Strong locators are an important component of reliable tests.

  • Download the entire object tree as an XML file or HTML file (for web views) for offline use.
Tip: To spy for objects on another screen of your app or web page, close Object Spy, navigate to the new screen, and then open Object Spy again.

Watch this short video to see how you can work with the Object Spy. Detailed steps follow.

Limitations

Objects identified with Object Spy may not be aligned as expected. This is a general issue with iPad devices that only affects the home screen. The issue is caused by invalid information returned from Apple's XCTest framework.

Step-by-step instructions

Expand a section to view the steps.