LoadRunner Practitioners Forum

TruClient - Table Row Example

Shawn Wales
Trusted Contributor.

TruClient - Table Row Example

See attached for instructions and required files.


If you ever needed to work with Tables in TruClient this sample should help.. or at least give you some ideas.


It is more of an advanced level example, but if you have some "DOM" and "JavaScript" experience you should be fine.


There are about 10 different things you can learn from this example:

- custom javascript functions in TruClient.

- calling those functions.

- using DOM XPath function.

- using If/Then blocks.

- using try/catch blocks.

- finding a cell in a table.

- using CONTAINS clause in an XPath.

- using dialogs to display debug messages.

- DOM arrays vs. XPath arrays

- When to use the Arguments section vs. JS-functions.js for your javascript code.

- Toolbox options for custom javascript.


If you have questions/comments/suggestions please let me know.

Micro Focus Expert

Re: TruClient - Table Row Example


New Member.

Re: TruClient - Table Row Example

Thanks, really helpful.
James Leatherma
Outstanding Contributor.

Re: TruClient - Table Row Example

Love the commentary!

Super Contributor.

Re: TruClient - Table Row Example

Thank you! I'd been struggling with how to capture the dynamic text contents of a specific object for use later in the script, and based on what you included here, I was able to put the following fairly generic function together in about 10 min to grab the node object. It actually took me more time to debug my XPath than to write the function, based on your good tutorial. :-)


 * Get text contents of node specified by xPath.
 * @arg     xpath       XPath for requested node.
 * @return              Node element.
function getNodeByXpath(xpath)
    /** Node to be returned. */
    var node;
    // Get node.
    try {
        node = document.evaluate(xpath,document,null,0,null).iterateNext();
    catch (err) {
        return false;
    return node;