Article - Picking and inspecting objects

Skip to end of metadata
Go to start of metadata

Table of Contents

Overview

Squish allows you to "pick" GUI objects of the currently running application. Once picked the following can be done with the object:

  • Inspect the properties
  • Insert the methods
  • Create verification points for property values (property verification points)
  • Create verification points for the visual representation of an object (screenshot verification points)

How to pick an object

  • Choose Run > Launch AUT (or the Launch AUT tool bar button) and choose the application to launch.

Or, if you have a test script already:

  • Step 1: Set a breakpoint on any line of your test script, ideally at a point where the object of interest will be visible in the AUT.
  • Step 2: Execute the test script and wait for Squish to stop at the breakpoint.
  • Step 3: Once execution has stopped the Squish Control Bar will be hidden and the full Squish IDE will appear showing the Spy perspective. In the Application Objects view there is a Pick toolbar button (which looks like an eye dropper). Click this toolbar button to switch Squish into "pick" mode — at this point the Squish IDE will be hidden.

  • Step 4: With Squish in "pick" mode return the to AUT (click its window title bar once to give it focus, possibly) and move the mouse over it. Squish will highlight each AUT object the mouse passes over. Move the mouse to the object of interest and once the red highlight rectangle is shown around it, click it to tell Squish that this is the object you are interested in.
  • Step 5: After picking, the Squish IDE will reappear and the picked object will be the only one shown in the Application Objects view.

Inspecting the GUI object tree

The objects listed in the Application Objects view can be expanded. The following work-flow describes convenient way to do this for a larger number of objects:

  • Click on the first object of interest.
  • Press the Right cursor key once to expand the node.
  • Press the Down cursor key once to select the first, newly expanded node.
  • Repeat.

This work-flow can be used in conjunction with maximizing the Squish IDE window, and maximizing the Application Objects view (double-click on the title bar of the Application Objects view) inside of the Squish IDE window. The result looks similar to this:

Squish technical support may be asking you to provide a screenshot of such a maximized, expanded Application Objects view for review or analysis.

Inspecting child objects

The nodes in the Application Objects view can be expanded if the respective object has child objects.

After picking one only sees the node of the picked object in the Application Objects view. If the picked object has children it is possible to expand the node of the picked object.

Unpickable GUI objects - Moving up and down in the GUI object tree

Sometimes it is not possible or very hard to pick a desired object directly.

Solution #1:

Pick a parent object as close as possible to the desired object, and then expand one or more nodes in the Application Objects view until one finally arrives at the desired object.

Solution #2:

Pick a child object as close as possible to the desired objects, and then use the Up (arrow up icon) button in the Application Objects view to move the GUI object tree upwards until one finally arrives at the desired object:

How to pick menus and other volatile objects

When picking volatile objects and creating verifications on them keep in mind that the test script must typically contain code to make the volatile object visible to enable Squish to find the object before the verifications can be performed.

In Squish for Windows, Qt & Java (AWT/Swing)

To pick menus and other volatile objects in Squish for Qt, Windows and Java (AWT/Swing - not SWT/Eclipse!) start picking and press and hold the Control/Ctrl key as long as you want to use the application. To pick, release the Control/Ctrl key and click on the object to be picked.

In Qt menus/popups (and their contents) are often deleted when the menu/popup closes. (This happens automatically when the menu/popup loses focus whenthe Squish IDE is shown after picking; this is done by the window manager/operating system and cannot be influenced by Squish.)

So working with the picked object in the Squish IDE may limited. (Even showing the object properties may not work.)

In other Squish editions

Approach #1 - Assign to variable and inspect properties in Variable view

  • Record an action on the respective object.
  • Change script to assign object reference to a variable. So change...
test.py

...to...

test.py
  • Set breakpoint on last line, execute to it.
  • Inspect properties of variable "o" in the Variable view:

Approach #2 - Output all properties and values

  • Record an action on the respective object.
  • Change script to output all properties and their values (when using a reusable function for this making the function part of the global scripts may be useful). For this the objects.properties() function can be used.

Approach #3 - Look up object type and API of that object type

  • Record an action on the respective object.
  • Look up the object type/class from the object name generated by Squish.
  • Look up the official API documentation from the vendor for that object type/class.

Object properties and methods

Notice that the Properties and Methods IDE views show the object's properties (with their current values) and the methods that can be called on the object.

Inserting verification points

If you want to insert a verification point you can do so now.

Inserting Property Verification Points

  • Check the check box besides one or more of the object's properties.
  • Select "Properties VP" or "Scriptified Properties VP".
  • Enter a name for the verification point.
  • Click the Verification Point Creator's Insert button.

Inserting Screenshot Verification Points

  • Check the check box besides one or more of the objects.
  • Select "Screenshot VP".
  • Enter a name for the verification point.
  • Click the Verification Point Creator's Insert button.

For information on how to make screenshot verification points more robust by ignoring pixel differences, resizing, etc. please see Viewing differences of failed screenshot verification points and Image comparison modes in screenshot verification points.

Inserting Table Verification Points

  • Check the check box besides one or more of table-based objects.
  • Select "Table VP".
  • Enter a name for the verification point.
  • Click the Verification Point Creator's Insert button.

Copying object names

If you want to make use of the object in a test script you can use the Application Object view's right-click context menu to copy the object's symbolic or real name to the clipboard ready to be pasted into your test script:

Using Copy Real/Symbolic Name will both cause the required object names (including the names of their window/container objects) to be added to the object map automatically.

Related Information

Labels:
menu menu Delete
object object Delete
spy spy Delete
picking picking Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.