Highlighted
Valued Contributor.
Valued Contributor.
673 views

Extracting Information under TrueClient

Hello,

I'm modeling a scenario under Trueclient, for a web application which displays a list of result (in a TABLE tag), for example a search result: (for example identifyer, firstname, name, company,...)

Is there a way to extract for example all the names, identifyers and put them in an array.

And then randomize on one element of the array to select for example a random element in the result list

 

 

 

0 Likes
3 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Extracting Information under TrueClient

Hi,

Yes, it is doable but you will have to write some JavaScript code.

Extracting data

Reach to the page where the table appears

Add a Generic Object Action step from the Toolbox. 

Select the entire table (in order to capture all table data) or more granular information based on your need

Change the step action from Click on table to Get Property.

Set the property as Inner HTML and specify the name of the variable you wish to store the data in. Inner HTML will help extracting specific values later on using the HTML tags as identifiers for where the real data is located. In other use cases it will probably be better to use Visible Text argument.

Now add an Ebaluate JavaScript step in the script and print the data to the log to keep a copy of how it looks like.

At this point you should can write JavaScript code that will parse the data stored in this variable and store it in array. Look for a reference in Google.

 

Randomize the selection of an element

You can do that either based on the data you kept above or without capturing the data at all.

1. Without capturing data

Select one of the rows in the table. Change the object identification to Descriptors. Edit the Descriptors to remove data specific to that particular element and add other properlties if needed to ensure the object description fits only a row from that table and nothting else on that page. Now check the Randomize selection check box at the bottom left side of the Descriptors dialog.

2. With the captured data

In the step that clicks on the element change the identification to Descriptors and in the descriptor that describe the value appeared during recording change the value to ArgsContext.<value from the array you saved earlier>You will also need change the toggle of that argument from Plain to JS.

I suggest watching this webinar. It includes several examples that will be very useful reference for you.

Good luck

Shlomi

 

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Extracting Information under TrueClient

Hi, thanks for your answer. Could you just be more precise, which lr_ instruction I should use, or is there an entry in the forum I can use ?

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Extracting Information under TrueClient

Hi,

Unfortuntaely it is not a single function. I tried sharing as detailed instructions as possible.

I advice watching the webinar and online examples: http://tchelp.saas.hpe.com/en/12.53/Content/TruClient/procedures/_tc_examples_ObjectIdentification_main_page.htm

Capture value to a string is pretty close to where you should start

Work with dynamic tables can also be useful for you

Regards,

Shlomi

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.