Setting the value

Table of contents


Description

The Set Value action is used to set values for various HTML elements:

  • Single line input fields. HTML <input> tag . It is often used to set name, password, address and other values. Example

  • Multi-line fields. HTML tag <textarea> </textarea> . It is used in cases when you need to enter a message, the text of an article or any other voluminous text.

  • Drop-down lists. HTML <select> tag . They can be found when choosing a gender, country and / or city of residence in various forms of registration.

An example of a form with the above fields:

Also, using this action, you can change not only the visible text, but also the code of elements on the page. This can be useful when one element overlaps another, in which case it is enough to replace the code of the extra element with an empty string.


How to add an action to a project?

Through the context menu Add actionTabsSet value

Through the action designer .

Or use smart search .


How to select a field to set a value?

This can be done in three ways. Through the action designer, context menu “Setting value from profile \ variable” and context menu of actions.

Open the page we need in the ProjectMaker browser and right-click on the element that we want to set the value to. From the context menu, select " To action designer ", the designer will be loaded under the browser window, select the " Set " action type and click the " Add to project " button.

Also, this action can be created from the context menu Add action → Tabs → Set value.


Action Setup: Main Tab

1. “ What

The text to be inserted. You can use both simple text and the macros {-Variable.someVar-} , {-Profile.Name-} .

2. " Where "

Here we select the attribute of the element for which we need to change the value:

  • value - the value of the element,

  • innerHtml\outerHtml ( what's the difference ) - HTML code of the element (replacing the value of one of these attributes with empty space, you can remove the element from the page).

  • You can also specify more familiar HTML tags here - id , name , class , style , placeholder .

This is not a complete list of possible values, there are others, but these are the most commonly used ones.

In this field, you can manually specify a value, and not choose from the proposed.

You can also use project variables here ( {-Variable.var_name-} )

Element search

Action Setting: More Tab

Expectation

1. Wait before executing

How long the template will wait before setting the value.

2. Wait no longer than

If after the specified time the item does not appear on the page, the action will terminate with an error.

3. Emulation

Default , the value is taken from the project settings .
Custom - set a personal emulation level for this action (project settings in this case will be ignored)


Usage example

Let's look at an action with a live example. We will use https://lessons.zennolab.com/en/registration as a test site. Going to the specified page, we will see a simple form with three input fields and one button, within the framework of this article we are only interested in the text input fields

The easiest way to create this action is to right-click on the input field and from the context menu select the item "To action designer". The action designer will appear under the ProjectMaker browser (if it has not been activated before).

ProjectMaker is trying to simplify your life as much as possible, and therefore values for the search (1) will already be substituted in the action designer (what these fields mean was written just above). The program does not always select the optimal values, sometimes you have to do it manually.

After the parameters for searching for an element have been selected, click Search , under this button there is a field (2) in which as many elements will appear as were found according to the specified settings (in our case, only one element was found, therefore this field displays the number “0 ”. As mentioned above, always try to select such search parameters so that there is only one element). And here is how the same field will look if several elements are found:

Then we select which attribute (3) needs to be updated in the found element. In our case, value is selected , i.e. the directly displayed value of the input field will be changed. After that, in the Value field (4), enter the text that you want to insert. In this field, you can use project variables in the form of macros - {-Profile.Name-} , {-Variable.generatedText-} , {-Page.Url-} . Variables can be used to construct complex constructs: this is how a string for inserting a date of birth based on values from a profile {-Profile.BornDay -}. {- Profile.BornMonth -}. {- Profile.BornYear-} might look .

Next, click the Test button (5) and see if the value of the required element has been updated. To make it easier to read the project, you can add a comment (7) of the action (an automatic comment is generated based on the entered value from the Value field and it is not always useful)

If you are developing a large and complex project that will need to be supported for a long time, then try to use the Action Comments as much as possible. After a week, a month or half a year, having opened the project, you can understand from the comments what and how it works, there will be no need to launch the project (to clearly see what this action does) and / or go into the action settings. You can also use notes in the project .

After everything is installed and checked, you can click Add to Project - our new action will appear on the project canvas.


Useful links