Object Spy: This feature enables pCloudy users to spy/inspect the app's structure on Android and iOS on the pCloudy platform.
One big advantage is its bilateral view which makes it easy for users to click on any element on one side and view the element details on the other side. Also,the generated script can be copied for future use.
So using ObjectSpy you can spy on an element, find an element and also perform actions to generate script.
Note - Inspecting elements on the screen using the Object Spy feature has different steps in the New and Old User Interface, please scroll down further to view the steps for the Old UI.
Steps to Enable Object Spy in the New UI
Users should be registered on the pCloudy platform.
Ensure that you have connected to a device and already installed an application.
Step 1 - Once you login to the platform and connect to a device, simply select Object Spy mode from the left Pane under All Actions.
Step 2 - Click on the Ctrl Key or select the Start icon on display to start the inspecting tool.
Step 3 - The inspection tools, elements attributes, values, etc will be displayed on the docking section on the right.
Step 4 - You can select any element to inspect on the screen of the device. We have chosen the "Accept" button in our example.
Step 5 - Once the attribute and the Value of the element is highlighted, you can simply click on the copy icon to copy this information to use in your scripts.
Note - A success notification will appear to denote that the infomation is copied to the clipboard
Step 3 - Once you have completed inspecting elements, You can click on the Exit Spy Mode to return the device to the Defaut Mode.
Please Note - The Quick Actions in the middle pane will be disabled until we exit the Object Spy Mode.
Steps to Enable Object Spy and its features using the Old UI
Users should be registered on the pCloudy platform.
Let's see in detail how to Spy, perform important Actions (use popular methods in script) and Find an element on screen.
A: Spying on an element/Object
Lets see the steps-:
Note: Steps are same for both Android and iOS.Here we have taken example of Android
Step 1: Connect a device and switch to OBJECT SPY MODE
- Once the device is connected,you will be able to see "Default Mode" on top in blue colour.
- Click on the dropdown,it will display two options.
- Click on "OBJECT SPY MODE" as shown in the screenshot below.
Note: If you wish to switch back to Default mode you can either press the "ESC" button or click "Default mode".
Step 2: App installation
- Install the app you wish to inspect.To install the app click on "Install" icon as shown below
Note: Once you start inspection, icons present in the middle panel (Install, keyboard, Send keys) will be disabled until you stop the inspection.
Step 3: Object selection
- As shown in the screenshot below, notification appears as "Click on Start or press ctrl on your keyboard"
Once you click on the "Start" button present on screen or "Ctrl" from your keyboard .All the elements present on that page will be selected as shown in the screenshot below.
Step 3.1: Spying any particular object
To spy any particular object ,you need to click on that particular object as shown in the screenshot below. You will get all the attribute of the selected object on right panel of the screen
In the below example we have selected the "Accept" button as an object.Selected object will get highlighted in red.
Note: If you wish to stop inspection you need to click on "Stop" on screen control
To copy any attribute's value,you need to hover on that particular attribute and you will be able to see the copy icon as shown in the screenshot below. Click on the copy icon to copy. Now you can paste it in your script.
Note: Out of all the attribute We recommend you to use xPath[Absolute] and xPath[Attribute]. Among these two xPath[Attribute] gives accurate inspection result.
Actions helps testers to use the popular/mostly used method in their script
Let's see how to use these Actions in your script.
Down on your right side you can see the panel name "Select Action to generate script".
Types of Actions-:
- Tab: Tab enables you to use .click() method in your script.
- Send Key: Sendkey enables you to use sendkeys() method which is used to send any text to your script.
- Clear: Clear method enables you to use the clear() method in your script
- Double tab: Doubles tab enables you to add double tab in your script
- Wait: Wait enables you to use wait in your script.
- Wait for Object: This enables user to use Explicit wait in the script
- Long Press: This enabled the user to generate a long press on an element.
Note: The explicit wait is used to tell the Web Driver to wait for certain conditions (Expected Conditions) or the maximum time exceeded before throwing an "ElementNotVisibleException" exception.
Example:-In the below example you can see how different method are inserted in script on single click
driver.findElement(By.xpath("//android.widget.Button[@resource-id='com.pcloudy.appiumdemo:id/accept']")).click();, driver.findElement(By.xpath("//android.widget.Button[@resource-id='com.pcloudy.appiumdemo:id/accept']")).sendKeys("Hello Google");, driver.findElement(By.xpath("//android.widget.Button[@resource-id='com.pcloudy.appiumdemo:id/accept']")).clear();,
B: Finding an element on the screen
ObjectSpy also helps you to find the occurrence or presence of any attribute for the selected Object using the "Find" icon.
Let's go through the steps:
- Navigate to the Find icon as shown in the screenshot below:
Note: You can find the presence/occurrence of any attribute using different attribute names present in drop-down as shown in below screenshot.
- Select "Attribute Name"
- Select "Search Type"
- Select "Attribute Value"
- Click on the "Find" button to see the result.
- Click on "Reset" to reset the entered details
Example:Here as an example we will find occurance of "Accept" button in that page. Lets see the steps to find occurrence of Accept in the page.
- Select the "Accept" button.
- All details of "Accept" attribute will be displayed as shown
- Click on "copy". Icon as shown below
- Click on "Find" icon
- Select attribute name as text
- Select search type
- Paste the attribute value that you have already copied.
- Click on the” Find” button
Selected element gets highlighted and its occurance will be displayed as shown below
Enjoy easy and effortless inspection of your application on ObjectSPy !!!