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.
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 !!!