“I don’t even see the code anymore;
all I see now is blonde, brunette, redhead”,
Cypher (Matrix the Movie)
Parent page: GUI Recognition with TestComplete
Unlike operators from the popular movie, automation engineer sees picture first, but has a need to get inside down to the code.
In TestComplete we can do that with Object Properties Wizard which retrieves both static data (like DOM details) and run-time GUI object properties.
In the picture above, Object Properties dialog displayed properties of Google logo panel, which contains image and text. The table goes over a hundred entries which can be overwhelming at first. However, some properties can not be used in GUI recognition, some other won’t help to identify object in a unique fashion.
For Web GUI, the most important recognition properties are the following.
- HTML ID (named “idStr” in TestComplete). A unique-per-page value, but not a mandatory HTML attribute.
- HTML Tag (tagName). Non-unique but mandatory.
- A text within HTML Tag (innerText). Non-unique and not mandatory.
- Floating hint text (Title). Non-unique and not mandatory.
Generally, if you don’t have a single property that allows uniquely identifying GUI object, you should compile a combination of properties which allows that.
- If idStr is not empty use only this property.
- Use combination of tagName and innerText, or combination of tagName and Title.
But what if such combination simply doesn’t exist?
Well, that makes it a little harder. We need to go up the hierarchy and identify parent or grand parent object that has a unique description. Once parent is retrieved, we may reconsider our description properties for the child. For instance, there could be multiple links across the web page, but only one within the particular table.
There are other, more complex GUI recognition challenges, that automation engineers must master – as testing begins from observation.