Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 13 Current »

Table of contents:

 Click here to expand the 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

Table of contents

 Click here to expand the table of contents

Before you can interact with an element on the page, you need to find it. In the Get Value, Set Value, Rise Event, Touch Event, Swipe Event actions, there are two ways to find items - classic and using XPath.


Classic - Search by HTML element parameters: tag, attribute and its value.

 

XPath - Search using XPath expressions . With the help of it you can implement a more versatile and resistant to layout changes way of data search in comparison with classic search or regular expressions.

Which tab

Select the tab on which the item will be searched.
Possible values:

  • Active tab

  • First

  • By name - when you select this item, an input field for the name of the tab will appear.

  • By number - in the entry field you will need to enter the serial number of the tab (numbering starts from zero!)

Document

It is recommended to set the value -1 (search in all documents on the page). 

Form

It is also better to set -1 (search in all forms on the page). Choosing this value will make the template more versatile.

 Why is it better to put "-1"?

Example: on page 3 of the form - search, registration, ordering goods. We need to click on the button in the order form and we have chosen as the value of the “Form” field - 2 (numbering from zero). After some time, a new login form appears on the site, and it is inserted in front of the order form. Number 2 will now be the login form, and our template will either give an error that the button was not found, or (much worse) will click on another button in another form.

In the program settings, you can select two checkboxes - Search all forms on the page and Search all documents on page, and then always when adding an element to the Action Designer, the document number and form will be set to -1.

Tag (classic search only)

The actual HTML tag from which you want to get the value.

You can specify several tags at once, the separator is; (semicolon)

Conditions (classic search only)

  1. Group - the priority of this condition. The higher this number, the lower the priority. If we could not find an element by the condition with the highest priority, then go to the condition with the next priority, and so on until the element is found, or until the search conditions are over. You can add several conditions with the same priority, then the search will be performed for all conditions with the same priority at the same time. 

  2. Attribute - HTML attribute of the tag by which the search is performed.

  3. Search type :

    1. text - search by full or partial text occurrence;

    2. notext - search for elements that do not contain the specified text;

    3. regexp - search using regular expressions
      By default RegeXp search is case insensitive. To change it you can prepend (?-i) to your expression (this mean “disable case insensitive mode”).

  4. Value - the value of the HTML tag attribute

  5. Match # - the ordinal number of the found element (numbering from zero!). Ranges and variable macros can be used in this field.

To delete a search term, left-click on the field to the left of it (highlighted in blue in the screenshot) and press the delete button on the keyboard.

Several conditions can be used to find the desired item.

It is always important to try to select search conditions in such a way that only one element remains, i.e. the serial number was 0 (numbering from zero).

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.


  • No labels