Resolving automatic variables in transaction element selectors

In transaction monitors, a script is executed during which the monitor will interact with elements on your page, such as drop-down menus, text boxes, or submit buttons. The monitor locates such elements on the page using a CSS or XPath selector.

In certain situations, you may need to select a random element on the page. For example, a click on one of several “Add to cart” buttons on a product overview page, to randomize which product actually gets added to the cart.

To this end, we now support the use of an automatic variable, which can be used to generate a random integer between two given values, and so select a random element on the page. As an example, the XPath statement (//a[@id='exampleLink'])[{{@RandomInt(1,5)}}] will select one of the first 5 links on the page with ID exampleLink.

By using the Uptrends website, you consent to the use of cookies in accordance with our Cookie Policy.