Action Constructor and XPath Search
🔗 Original page — Source of this material
Description
The Action Constructor is a universal tool for working with page elements, allowing you to select the most suitable identifiers for finding them.
To use this feature, you’ll need some basic knowledge of HTML markup.
How to open it?
There are two ways to open the constructor:
- Right-click the element you’re interested in on the page and choose *Send to Action Constructor from the ❗→ context menu.

- The second way is from the ❗→ Element Tree window. Right-click the desired element and select *Send to Action Constructor.

When you add an element to the Action Constructor, its available properties and attributes are automatically added to the Properties window.
Search parameters
Classic Search
Document number
It’s recommended to set the value to -1 (search in all documents on the page).
Form number
It’s also best to set this to -1 (search in all forms on the page). By doing this, your template will be more universal.
> > Example: There are 3 forms on the page—search, registration, and product order. Suppose you need to click a button in the order form, and you select “Form” value as 2 (index starts at zero). Sometime later, a new login form appears on the site and is inserted before the order form. Now number 2 will be the login form, and your template will either throw an error saying it can’t find the button, or (even worse) it’ll click a different button in a different form.
In the program settings (Settings → Recording), you can check “Search in all forms on the page” and “Search in all documents on the page” so that the number for document and form will always be -1 when finding elements.
Tag
The HTML tag you want to find.
Example:
<div class="visible" id="username"></div>
div is the tag.
Attribute name
The attribute of the HTML tag you’ll search by.
<div class="visible" id="username"></div>
class and id are attributes.
Value
The value of the selected HTML tag’s attribute.
<div class="visible" id="username"></div>
visible and username are attribute values.
Search type
- text - search by full or partial text
- notext - searches for elements that do not contain the specified text
- regexp - search using ❗→ regular expressions
By default, the search is case-insensitive. To make a regular expression case-sensitive, add
(?-i)at the start of the expression (this disables case-insensitive search).
As shown in the screenshot, after clicking the *Search button, three elements were found. This isn’t ideal—always try to pick search parameters so that only one element is found.
XPath Search
With ❗→ XPath expressions, you can create a more universal and robust element search algorithm compared to classic search or regular expressions.
Document number and Form number work the same as in Classic Search.
XPath
Field for entering your ❗→ XPath expression.
Variants
Here you can select one of the suggested *Constructor expressions.
If none of the suggested options suit you, you can write your own XPath expression.
Choosing an action
You can select one of three possible actions
Set - ❗→ Set value
- Attribute — the attribute of the element where you want to set a new value
- Value — the text you want to insert. You can use plain text or project variables like
{ -Variable.someVar- },{ -Profile.Name- }.
Get — ❗→ Get value
- Attribute — the attribute whose value you want to get.
- Value — this will display the value of the found attribute.
Rise — ❗→ Perform action
- here you can choose the necessary action to perform on the found element.
- For *drag and *drop actions, there are two extra fields for coordinates.
Final steps
Testing
After picking the necessary search parameters and selecting the needed action, it’s a good idea to test your parameters by clicking the corresponding button.
Comment
It’s a good idea to leave a comment for the action, since automatic comments tend not to be very informative.
Default comments

The same actions, but with your own comments

Adding to project
Once you’ve chosen the right parameters, found the element, and selected and tested the needed action, you can click *Add to project.
Useful links
- ❗→ XPath
- ❗→ Regular expression tester
- ❗→ Set value
- ❗→ Perform event
- ❗→ Get value
- ❗→ Element property window
- ZennoPoster + xPath with Yandex.Market example (contest article from the forum)