The operators are used for concatenation or subtraction of the results returned from blocks. There are two types: DOM operators and String operators.
DOM Operators
DOM operators can ONLY have members of DOM blocks. Therefore, only XPATH and JQUERY blocks can be used in DOM operations.
The following expression is invalid:
{{REGEX:abc}} - {{JQUERY:.main}}
Addition (+)
Use +
to add the result DOM elements from DOM blocks into a collection. The result of the collection will be the concatenated string result of each DOM element in the collection. For example:
{{JQUERY:#content}} + {{JQUERY:#foot}}
The example above will return the HTML from element which has id of content
along with the HTML from element which has id of foot
.
Subtraction (-)
Use -
to exclude some DOM elements from the result of a DOM block. For example:
{{XPATH://div[@class="content"]}} - {{XPATH://h1}}
This will get the content of a div
which has a class content
, while h1
is removed from the result.
Note
- DOM operators can’t be mixed in a single group or query if there’s no group exist.
For example, the following expression is invalid
{{XPATH://div}} - {{XPATH://div/h1}} + {{XPATH://article}}
For example, the following expression is valid
{{XPATH://div}} - {{XPATH://div/h1}} - {{XPATH://article}}
String Operators
String Operators can be used for both DOM and String Blocks.
Concatenation (&)
The concatenation operator can concatenate the string result from blocks into a single string. For example:
{{JQUERY:#content}} & {{LITERAL:<p>Copyright 2015-2016</p>}}
This will return the HTML of an element which has id of content
, along with a copyright paragraph.