Insert Tag
The Insert Tag action inserts 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 Insert 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.
- Insert Tag Where
-
Choose where to insert the new tag relative to the found tag. Options are:
- As First Child of Found Tag
- As Last Child of Found Tag
- Before Found Tag
- After Found Tag
Note the following rules:
- If a new tag is inserted before an <html>, <head>, or <body> tag, it will become the first tag in <body> if the document contains a <body> tag. Otherwise, it will become the first tag in <html>.
- If you insert the new tag after a <head> tag, it will become the first tag in <body>.
- If you insert the new tag after a <html> or <body> tag, it will become the last tag in <body>.
- HTML tags can not be inserted in a text node. Instead, the surrounding tag must be selected.
- 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 Insert 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 only against 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, the pattern is matched against the input without regard to the character case; e.g. "KoFaX" is considered equal to "kOfax".
- Expression
-
This field contains an expression whose result is used to create the new tag. The expression can refer to the submatches of the pattern in the Pattern field using the $n notation. For example, 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.