LR TruClient - Unable to get evalXPath to work correctly

Not sure if the below is a bug or something I’m doing incorrectly, I have a number of elements that need to utilize similar logic, so any / all assistance would be much appreciated!

Here is the exact error I’m getting, along with the code I’m using.

 This code works in Selenium, so not quite sure what’s going on with TruClient.

Link to sample page (may take a while to load - known issue)

UPDATE: Using LR 12.55 and the code is in a Function Library element if that helps



//Define Objects
var imagePickerArray;
var imageSelectedArray;

//Search for existence of Image Picker Object
imagePickerArray = evalXPath("//IMG[@class='gwt-image-picker-option-image']");
//Search for Selected Image Object
imageSelectedArray = evalXPath("//IMG[@class='gwt-image-picker-option-image-selected']");
//If image pickers exist AND no image is currently selected, select the first image picker object
if ((imagePickerArray.length > 0) && (imageSelectedArray.length == 0)) {


Error Message and Element Identification Information

TruClkient Error Message.pngelement id.png

Element Identification Information

  • Hi, kjackey,

    The evalXPath function is only available in the scope of Javascript object identification method.

    It is not defined in an "Evaluate JavaScript" code step, so it cannot function there.

    If you are trying to perform an operation on an object, I'd suggest using an "Evaluate JS on Object" or a "Generic Object Action" step.



  • Hmm.. no luck, the Evaluate on Object is also giving me the evalXPath is not defined error (screenshot attached)


    12-11-2017 11-02-14 AM.png


    Here's what I'm trying to do, maybe there's a better way [do I possibly need to break this up into multiple TruClient steps]?

    1) Go to the indicated page 

    2) Check to see if there is at least one image selector on the screen (as seen in picture attached to first post and identified by the



    3) If Image picker is present, determine if any of the images have been detected xpath id is 



    4) A second option (If selector is present),  would be to  determine if the Selected Color Info Text (attached screenshot, xpath is 



    12-11-2017 11-09-52 AM.png 

  • Verified Answer

    Hi again,

    Sorry if I wasn't clear.

    The evalXPath function can only be used in the Javascript object identification method, as part of the object identification code in the "Object" section of a step.

    See the image below:

    2017-12-11 18_32_53-TruClient Lite - Untitled.png


Reply Children