Tuesday 5 May 2015

How to Set Proxy Values for all the Ajax TruClient Scripts?

LoadRunner launches Firefox in a temporary profile every time a script is opened for development.

To make the proxy settings available across all these profiles please use the global profile settings do this:

• Open VuGen.
• Open an Ajax TruClient script.
• Go to Tools > Ajax TruClient Browser Options…
• In the dialog that opens (“Ajax TruClient Browser Configuration”), select the Proxy tab and
define the appropriate Proxy settings.
• In the script, open the Run-Time Settings dialog and then select the General > Other Settings
node.
• In the Proxy selection node select the “Use global proxy settings” option. This will make sure
that every time the script is opened for development the proxy settings are refreshed from
the Ajax TruClient Browser Options.

The Run-Time Settings also enable defining specific proxy settings for each script.

How Can I Use JavaScript to Locate Objects in Ajax True client script?

Using the JavaScript identification method you can write JavaScript code that references the returned
document and can use CSS selectors and other standard functions.

For example, the page returned by the server contains multiple links with the same “title” attribute
(search results) and we want the script to randomly click on one of the available links.
Object identification for this case, using the JavaScript identification method, may look something like this:

var my_results = document.querySelectorAll('a[title="SearchResult"]');
my_results[Math.floor(Math.random() * my_results.length)];