Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.

A closer look at TruClient Object Descriptors

yuditb Absent Member.
Absent Member.
11 11 9,513

Have you ever tried to record a business process only to have the objects not recognized by TruClient?
While you are thinking about it, when was the last time you’ve tried to identify an application object and failed?

In TruClient we introduced a new feature (available from version 12.02) that might solve these types of challenges immediately.

 

TruClient is an innovative browser-based testing technology for performance, load and automation.
TruClient supports simple Web as well as modern JavaScript-based applications. TruClient’s scripting engine is embedded within the browser, and behaves like a true browser client.
It utilizes a unique, patented approach to object recognition, which makes it an extremely flexible and extensible solution for testing Web2.0 applications.

 

TruClient was introduced to the world few years ago as a novel and groundbreaking solution for load testing Web2.0 Rich Internet Applications (RIA). TruClient technology was first implemented as a browser extension integrated with the Firefox browser in LoadRunner 11.00. In LoadRunner 11.50, the TruClient for Microsoft Internet Explorer (IE) protocol added the same functionality integrated into the IE browser.

 

Introducing TruClient Descriptors

In the cases where the automatic object identification method is insufficient for your use case or the improved object identification does not help, you can now use a new object identification method that will enable you to define and pinpoint the required object.

 

What are Descriptors?

The nametag “Descriptors” comes from the fact that they describe the object in a more intuitive and visual way.

Descriptors are one of the TruClient object identification methods that are complimentary to other methods such as: Automatic, XPATH and JavaScript.

With the new Descriptors method, you can watch, select and adjust the properties of the object that TruClient should look out for.
Properties can also be deleted or added, parameterized and programmed.

 

To show an example of the use of TruClient Descriptors:-

  1. Let’s say you start recording and then realize that TruClient misses an object ...
  2. Open the Step Object section in TruClient
  3. In the ID Method  line select Descriptors
  4. Choose the ‘Click Here to Edit’ button.
  5. The Descriptors Editor dialog box opens up and you can edit the descriptors here.
  6. After you are done, press the OK button and the script will now identify the object with Descriptors.

 

Technical Details

What actually happens during the Recording phase?

During the recording process, TruClient gathers information from the object and creates the Descriptors data set.
In that data set there are three main entities – Property, Operator and Value.

For example, TruClient always identifies tagName as a first mandatory property with operator ‘equals to’ (case ignored), the value changes based on the identified element.

In the above snapshot it is ‘A’ since TruClient identified a link.

In the example above there is additional property, “text”, with “LEARN HTML” as its’ value.

In many cases the automatically generated properties are sufficient for identifying the object.

But if not, feel free to add additional properties manually.

 

Enhancing the Description

 In some cases, the recorded description has to be modified for various reasons.

For example, to create a more accurate identification, to parameterize a value of one of the properties or to find one of the occurrences of an object that appears several times on the same page.

To support that, TruClient Descriptors provides several options.

The following examples illustrates possible use cases and their solution.

  • Parameterize a value

In some business processes you are required to click a different menu item for each iteration, as shown here:

Recording the click on the first link will result in the following description:

 

 

The value of the text is now interpreted to a constant value “CSS HOME”.
 In our complex scenario, we want to enhance it a little so each time TruClient runs, it will choose a different link from the list of parameters.

  1.  First change the value type from “Plain Value” to “JavaScript”:
  2. Now change the value of the text to be taken from a parameter: TC.getParam("LinkText")
  3. Lastly, define the “LinkText`” in VuGens Parameter List:
  4. Finally, run the script.

Now, for each iteration the next link will be activated.

Note, in VuGen you can make the ‘Select Next Line’ either Random or Sequential etc. to comply with your business requirements.

  •  Object ordinal

When there are multiple objects with similar characteristics on the same page and you need to use one of them, there is a need to somehow identify it uniquely.

If there is a different constant property that is unique to the searched object, it can be added using the “New Condition” button.

 

 

If no such distinctive property exists, use the “Object Ordinal” definition to specify which occurrence to choose.
(The default ordinal number is 1, in the snapshot below it was changed to 2).

 

 

If you aren’t sure which object should be selected, use the “Highlight” button when the application is open on the relevant page.

 

Note that you can also parameterize the Ordinal value as shown below.
This could be used when your application has multiple objects with the same characters and you wish to click on a different object for each iteration.

The parameter will have the sequential values 1-n and each iteration TruClient will find one of the similar objects.

 

Advanced TruClient Descriptors settings

  • Add a Descriptor Property

You can add a new property to the descriptors.
It can be a TruClient pre-defined property from the list of properties (e.g. id, name, class, label and more) or it can be a custom property or attribute.

The snapshot below shows the added “MyId” custom attribute, its’ value is returned by the JavaScript function called ‘getMyId’.

The function interacts with the application DOM to get the attribute value.

 

 

 

  • Deleting a Descriptor property

It is also possible to delete a property in cases where it does not contribute to the object description. When the property value is dynamic you should consider deleting the property and use something else that uniquely identifies the object (e.g. ordinal).You can also use it with a different operator or write a function that will return the value using the same logic the application under test (AUT) uses.

 

  • Operators

There are several operators you can use to test the property value.

Apart from the simple operators like ‘equals’, ‘equalsIgnoreCase’, ‘equalsIgnoreDigits’ etc. there are advanced operators:

  • equalsIgnoreChars-
    Compares the object property to the value specified in the descriptor editor ignoring any characters specified in the Arguments section.
    For example, a descriptor with:
    Text” as Property
    'equalsIgnoreChars’  as Operator
    X” as Value and “Y and Z as arguments
    will return True for an Object with ‘XYZ’ text.
  •     isRegExpMatch-
    Checks if the object property matches a regular expression specified in the value.
    The regular expression is a JavaScript regular expression object, and the value should be “JavaScript” and not “Plain value".

 

As explained in this post, TruClient Descriptors offer a non-technical approach for identifying Objects in the application. The Descriptors can be customized to handle dynamic application data, using a wide range of capabilities for both the novice and expert users.

Enjoy 🙂

 

Thanks to Michal Barak for providing this informative post.

 

You can try TruClient in LoadRunner for yourself here.

Join us in TruClients LinkedIn group.

 

 Feel free to leave a comment in the box below.

11 Comments
Not applicable

This feature is really wonderful!  It indeed help user to idetify the wanted object

Not applicable

To be consistent with other functions in TruClient:

 

The Ordinal should accept 0 (zero) as an option to pick a Random object.

 

This would also greatly enhance the ability to use Descriptors as most of the time we want to pick a Random item from what is returned.

Shlomi Nissim Acclaimed Contributor.
Acclaimed Contributor.

The ability to pick a random object, using Descriptors, will be introduced in one  of our future releases 

Absent Member.. Shawn Wales Absent Member..
Absent Member..

Shlomi,

I see 3 different ways to implement the Random Ordinal and be consistent with how other areas of TruClient work.

1. Set Ordinal to 0

2. Set all returned objects to the OBJECT reference...  so we could simply change Ordinal to JavaScript and enter code like Random OBJECT.

3. Add another control that is a checkbox that says Random.   This would be my vote as it is more intuitive and should be used anywhere you might return multiple objects and randomly want to pick one.

I feel this should be very high on the priority list of enhancements.  This is something we would use in every script for every test.

 

Thanks,

Shawn

yuditb Absent Member.
Absent Member.

Thanks Shawn,

I am very pleased to say that in our latest release 12.53, this is currently supported !  
So enjoy this feature and trust that it will serve you well 🙂

Not applicable

The descritpion is fine but not working.

We are using LR 12.53 and allways get the error

"Click on Desktops link ** failed - target object was not found. Reason: JavaScript Exception Occurred: TC is not defined"

This is only with a step "Click". In other steps it works fine. What is the problem?

 

 

Shlomi Nissim Acclaimed Contributor.
Acclaimed Contributor.

Hi Kay,

I am not sure what you are doing but I assume you should use ArgsContext. prefix before TC in order to avoid this error.

Regards,

Shlomi

Not applicable

Hello, my objects (links) are recognised correctly in vugen (using xpath) and the script runs perfectly.

But.. when I try to run the same script through controller (1 user) , the script fails with (object not found..) error.

What could be the reason for this and how could this be resolved.

 

Regards,

Amar

Shlomi Nissim Acclaimed Contributor.
Acclaimed Contributor.

Hi Amar,

It is more appropriate posting your question in LoadRunner-Practitioners-Forum. This blog post is focused on descriptors and not object identification in general.

I also advice watching TruClient Webinar about object identification for general knowledge.

Regards,

Shlomi

Not applicable

can some one tell how to implement for passing javascript variable defined in one step to another step of the descriptors.

 

Regards,

Anil

techshivam Trusted Contributor.
Trusted Contributor.

Is it possible to use a 'OR'/'AND' operators for the text value in Descriptors ? For a particular Locator based on the class, tag, value of a text. Sometime for multilingual languages we have different text for the same page. How can we target multiple text value here in descriptors ? If I want to check for a box which could either be 'Hello' or 'Namaste', but come on the same position.

Thanks!

About the Author
Yudit is the Functional Architect for LoadRunner, a product that is a core part of the Software Performance Validation Suite.
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.