Action Constructor and XPath Search
🔗 Original page — Source of this material
Description
The Action Constructor is a tool for working with web page elements. You can use it to choose the properties ZennoPoster uses to find an element, then perform an action on it: for example, click a button, fill in a field, or retrieve text.
It will help you understand the page structure, element names, and their attributes.
How to open it?
There are two ways to open the constructor:
Method 1. From the page context menu
Right-click the desired element on the page and select Send to Action Constructor:

Method 2. From the Element Tree
Open the Element Tree window, then right-click the desired element and select Send to Action Constructor:

When you add an element to the Action Constructor, its available properties and values automatically appear in the Element Properties window.
Search parameters
There are two ways to search for elements: classic search and XPath search.
Classic Search
This method finds an element by its HTML tag, attributes, and their values.

Document number
Enter -1 to search for the element in all documents on the page. This makes the search more versatile.
Form number
Enter -1 to search for the element in all forms on the page. If you specify a particular form number, the template may stop working when the site structure changes.
Example
The page contains three forms: search, registration, and product order. The order form is number 2 because numbering starts at zero.
If the developers add a login form before it, the order form will have a different number. As a result, ZennoPoster may fail to find the required button or perform the action on a different element.
If you enable these options in Recording Settings, the form and document numbers will always default to -1.
Tag
The HTML tag of the element to find.
For example:
<div class="visible" id="username"></div>
In this example, div is the tag name.
Attribute name
The HTML tag attribute ZennoPoster uses to find the element.
In our example:
<div class="visible" id="username"></div>
class and id are attribute names.
Value
The value of the selected attribute.
In the example above:
visibleis the value of theclassattribute;usernameis the value of theidattribute.
Search type
Three search types are available:
text— the attribute value must fully or partially match the specified text;notext— the attribute value must not contain the specified text;regexp— search using a regular expression.
The search is case-insensitive by default. For example, Username and username are treated as identical.
To make a regular expression case-sensitive, add
(?-i)at the beginning.
Where possible, choose parameters that leave only the desired element in the results. Otherwise, ZennoPoster may perform the action on the wrong element.
XPath Search
XPath finds elements by their position and properties within the HTML document structure. It lets you create a more flexible search that is more resilient to changes in the site's layout.

Document number and Form number work the same way as in classic search. To search all documents and forms, set both to -1.
XPath
The field for entering the XPath expression ZennoPoster uses to find the element.
Variants
You can select one of the XPath expressions generated automatically by the Action Constructor.
You can write your own XPath expression and enter it in the XPath field.
Choosing an action
After configuring the search, choose the action ZennoPoster should perform on the element it finds. Three options are available: Set, Get, and Rise.
Set (set a value)
The Set value action changes the value of the selected attribute.
- Attribute — the element attribute to assign a new value to.
- Value — the data to write to the attribute. You can use plain text or project variables, such as
{-Variable.someVar-}or{-Profile.Name-}.
Get (get a value)
An action for getting the value of the selected attribute.
- Attribute — the attribute whose value you want to get.
- Value — the value of the attribute found.
Rise (perform an event)
Performs an action on the element found. For example, you can click it or trigger another available action from the list.
For drag and drop actions, two additional fields appear for specifying coordinates.
Final steps
After configuring the search and choosing an action, we recommend checking the result and adding a clear comment before saving the action to the project.
Testing
Once you have configured the search parameters and the action, click the test button. This lets you check in advance that ZennoPoster finds the right element and performs the selected action correctly.
Return to the settings and change the search parameters.
Comment
Add a short, clear comment to the action.
Default automatic comments do not always make it easy to understand what an action does.
| Default comments | Custom comments |
|---|---|
![]() | ![]() |
Adding to project
Make sure that:
- the search parameters are configured;
- ZennoPoster finds the right element;
- the correct action is selected;
- the test has passed.
Then click Add to project. The new action will appear in the project, ready to use.
Useful links
- ❗→ XPath
- ❗→ Regular expression tester
- ❗→ Set value
- ❗→ Perform event
- ❗→ Get value
- ❗→ Element Properties window
- ZennoPoster + xPath with Yandex.Market example (contest article from the forum)

