Replace Tag

The Replace Tag action replaces the found tag with a new tag. Any JavaScript present in the HTML of the new tag will be executed, unless JavaScript execution is disabled in the options.

Properties

The Replace Tag action can be configured using the following properties:

HTML of New Tag:
Specify the HTML of the new tag. The HTML can be specified in a number of ways as described below.
Options:
The robot's options can be overridden with the step's own options. An option that is marked with an asterisk in the Options Dialog will override the one from the robot's configuration. All other options will be the same as specified for the robot.

Specifying the HTML

The HTML of the new tag can be specified in the following ways:

HTML:
Simply write the HTML of the new tag.
HTML from Expression:
Write an expression whose result is used as the HTML of the new tag.
HTML from Expression and Pattern:
Write a pattern which is matched against the found tag, and an expression whose result is used as the HTML of the new tag. Use this way of specifying the HTML if parts of the found tag should be used when creating the HTML of the new tag.
Pattern:
A pattern which is matched against the found tag for the Replace Tag action. The pattern must match the entire found tag, otherwise an error will be generated.
Match Against:
Specifies what the pattern should be matched against from the found tag.
  • "Only Text" specifies that the pattern should be matched against only the text in the found tag.
  • "HTML" specifies that the pattern should be matched against the HTML of the found tag.
Ignore Case:
If this is checked, then the pattern is matched against the input without regard to the character case; e.g. "KaPoW" is considered equal to "kApow".
Expression:
This field contains an expression whose result is used as the HTML of the new tag. The expression can refer to the submatches of the pattern in the Pattern field using the $n notation. For example, you can enter $1 in the expression to get the first submatch in the pattern (i.e. the text that matches the contents of the first pair of parentheses in the pattern).
HTML Converted from XML Variable
Choose an XML variable whose content will be transformed to HTML and used as the HTML of the new tag.
Use Default Options:
If checked, the default options of the robot are used (configured as part of the robot configuration). Otherwise, the specific options configured in the Options property below are used.
Options:
Configure the options to use if the Use Default Options property is not checked.