Validate actions

Validate actions enable you to verify that specific content is present on the page at a given point within the script. You specify the content that the agent must find (or in the negative case, must not find) on the page before it can continue processing the script. If a match is not found (or, in the negative case, is found), the agent reports a failure and flags it as a Content Match Error.

There are two types of validation:

Step Match

A step match lets you specify a string to look for. The agent looks at all text-based page assets downloaded, including objects pulled from cache, to locate that string.

This match enables you to match against content that may not necessarily render in the browser and is only visible in the source code.

Element Match

An element match lets you specify a specific DOM element to validate against. You can tell the agent to match that element or to locate a string within that element.

The validation takes a target locator for a page element, and if it successfully locates that element and you also specified a string to validate, it tries to locate that string within the outerHTML of that element. If you do not specify a string to validate, the validation passes if a match is found for the locator.

Each browser agent does this validation differently. The IE agent performs the validation against the outerHTML of the element specified. In Firefox, the outerHTML attribute does not exist, so the agent removes the element from the DOM, performs the validation against the removed element, and then reinserts that element back into the DOM. It is highly recommended that users select a specific DOM element to validate against instead of using the entire HTML element, because upon reinserting the removed DOM element, the Firefox agent may re-execute JavaScript within the removed element, and possibly cause errors.

Validation options

You can use the following options to modify the behavior of a validation:

Fail if found

Makes negative content matching possible. Select this option to set a script to fail if a match is found.

Regular Expressions

Enables you to specify a regular expression pattern to match, if the string you need to validate is dynamic. This option accepts JavaScript regular expressions.