Back to Blog

Having trouble with those new TruClient Functions? Here’s why

LoadRunner 11 has added the AJAX Truclient protocol, and with it new functions for it that are unlike the old C-based functions. As of this writing, there still isn’t an entry in the function reference for the protocol with examples of usage, but only documentation found in the help documentation.

However, recently we found that some of these functions are not correct. HP recently added a new knowledge base article address this:
KM1025315

Problem: When trying to use the following functions in an step “Evaluate JS”:

LRAPI.userDataPoint
UtilsAPI.clearCookies
UtilsAPI.clearCache

the following error message appears:

“Evaluate JS UtilsAPI.clearCookies (or clearCache) ** failed – an argument is invalid: ‘Code”:JavaScript exception ‘ReferenceError: UtilsAPI is not defined’ during evaluation”.

Cause: The correct API prefixes are LR and Utils.

Fix:

Use the prefixes LR and Utils instead of LRAPI and UtilsAPI:
LR.userDataPoint()
Utils.clearCookies()
Utils.clearCache()

This pretty much amounts to an “oops”, but at least they found it. If you need to use this functionality, make sure to make a note of these corrections.

Back to Blog