Objects in HTML pages can also be identified using their DOM paths.
To get a DOM path for an object one of the following methods can be used.
Launch the application from inside Squish and make sure the relevant object is visible. Then click Squish's Application Object view's Pick toolbar button and then click the object in the application. (You may need to right-click rather than left click to avoid unintentionally activating the item or following a link.) This method is particularly useful for objects that don't normally have multi-property names (such as items in a table).
Obtain a reference to the object in the usual way, i.e., by calling the waitForObject() function with the object's symbolic or real (multi-property) name, and then call the hierarchicalQualifiedName() method on the object. This method returns the DOM path. For example:
You can also use these commands in the Squish IDE's script console where they will print out the object's DOM path in the test log view: you can then copy it from there.
Older versions of Firebug may be incompatible with running Squish tests. Upgrade or disable it to run your tests if you have problems.
Note that the DOM path of an HTML object can change when dynamic portions are added or removed from the HTML page. This means that the DOM path is context-specific, so if the context changes the path may need to be retrieved again.
This problem can be avoided by having the web developers add HTML attributes that give the elements you are interested in unique names. This approach is described at [Explicitly Naming Objects].