Skip to main content
DocumentationAppiumInspect ElementObject Spy Public

Last updated on 21 Jan 2025

Object Spy in Functional Experience

Overview

Object Spy is a live-inspection tool in Pcloudy’s Functional Experience (Real Devices). It lets you open a real device, interact with it, and inspect the on-screen UI elements at the same time — the live device view and the element inspector appear together in a single view. Object Spy also provides a Session ID for the running session, which you plug into your own Appium script so your automation runs against that same live device.

This guide walks you through enabling Object Spy, capturing the Session ID, and wiring it into your Appium script.

note

What's new: Previously, you had to select a specific application before using Object Spy. That step has been removed. Object Spy now inspects elements from both installed and pre-installed applications automatically, without requiring you to choose an app beforehand, making it easier to identify elements across every application on the device.

Prerequisites

  • User must be registered Pcloudy account
  • A Pcloudy account with access to Functional Experience (Real Devices).
  • The app you want to test (APK for Android / IPA for iOS) uploaded to Pcloudy, or the URL of the website you want to test.
  • Your Appium automation script ready to edit (the examples below use Java).
  • Your Pcloudy Username and API Key — both are required in your script (the API Key is available in your Pcloudy account settings).
  • The Pcloudy cloud / region you want to use — the endpoint host depends on it (for example, ind-west.Pcloudy.com).

Steps

Step 1 - Open Functional Experience

In the Pcloudy left navigation, under Experience Testing, select Functional Experience. Choose Mobile App or Mobile Browser at the top, then select your platform tab (Android or iOS) and pick the device you want to test on.

Step 2 - Debugging (required for Object Spy)

Before launching the session, tick the Enable Debugging checkbox at the bottom-right of the device screen, then click Start Testing.

info

Important: Object Spy is only available when Debugging is enabled. Make sure Enable Debugging is checked before you start the session—it cannot be turned on after the session has launched.

Step 3 - Switch to Object Spy mode

After the device connects, the session first opens in the standard live view. Select Object Spy from the left navigation menu (just below Switch Device) to bring up the inspector. In Object Spy, the live device screen and the inspector are shown together in the same view — a Quick Actions panel, an XPath search bar, a NATIVE_APP / WebView context selector, and a Hierarchy (element tree) panel — so you can drive the device and capture element locators side by side.

While in this mode you will see an Exit Object Spy control in the top bar to exit once you are done.

Step 4 — Load your app or website

Depending on what you need to test, install or launch the app on the device (Mobile App), or open the target website in the browser (Mobile Browser). The element tree in the Object Spy panel reflects whatever is currently shown on the device screen.

Step 5 — Copy the Session ID into your script

Each Object Spy session has a unique Session ID. Copy it from the Object Spy top bar using the copy icon next to the device name, then set it as a capability in your Appium script:

capabilities.setCapability("appium:Pcloudy_Username", "<your-Pcloudy-username>"); 

capabilities.setCapability("appium:Pcloudy_ApiKey",   "<your-api-key>"); 

capabilities.setCapability("appium:sessionId",        "<session-id-from-step-5>"); 

  

driver = new AndroidDriver( 

    new URL("https://ind-west.Pcloudy.com/appiumhybrid/wd/hub"), 

    capabilities); 
info

Important: appium:Pcloudy_Username and appium:Pcloudy_ApiKey are required in addition to the Session ID—the session will not authenticate without them.

note

Note: Replace the host (ind-west.pcloudy.com) with the cloud you want to use.

Full example (Java — Android)

Putting it together, the Session ID from Object Spy and the Pcloudy endpoint look like this in your test setup:

DesiredCapabilities capabilities = new DesiredCapabilities(); 

  

capabilities.setCapability("appium:Pcloudy_Username", "<your-Pcloudy-username>"); 

capabilities.setCapability("appium:Pcloudy_ApiKey",   "<your-api-key>"); 

//sessionId Capability 

capabilities.setCapability("appium:sessionId",        "680be28d-d3d5-4294-a836-894529fc8101"); 

  

AndroidDriver driver = new AndroidDriver( 

        new URL("https://ind-west.Pcloudy.com/appiumhybrid/wd/hub"), 

        capabilities);

For iOS, use IOSDriver in place of AndroidDriver. The credentials and Session ID work the same way; only the endpoint host changes with your region (for example, us.Pcloudy.com).

Important Notes

  • Your Username and API Key are required capabilities in addition to the Session ID. The API Key is available in your Pcloudy account settings.
  • Enable Debugging must be checked before Start Testing — it cannot be turned on after the session has launched. You then switch to Object Spy from within the session.
  • The Session ID is valid only while the live session is active. Keep the live session open while your script runs; your automation is attached to that same live device.

Endpoint Quick Reference

ItemValue
Endpoint (Appium Hybrid)https://<your-cloud>.Pcloudy.com/appiumhybrid/wd/hub
Cloud host (examples)ind-west.Pcloudy.com / us.Pcloudy.com
Username capabilityappium:Pcloudy_Username
API Key capabilityappium:Pcloudy_ApiKey
Session ID capabilityappium:sessionId
Driver - Androidnew AndroidDriver(new URL(endpoint), capabilities)
Driver - iOSnew IOSDriver(new URL(endpoint), capabilities)

Did this page help you?