Skip to main content

Touch Event

🔗 Original page — Source of this material


Swipe Event

Click here to expand the table of contents
  • 1 Description
  • 2 How do I add an action to my project?
  • 3 Where can this be used?
  • 4 How do I work with the action?
  • 4.1 Selecting the event
  • 4.2 Finding an element
  • 4.3 The “Advanced” tab
  • 5 Usage example
  • 6 Useful links

Description

This action allows you to emulate finger movements on the screen (swipe).

How do I add an action to my project?

Through the context menu Add actionTabsSwipe event

image-20200816-113705

Or use the ❗→ smart search.

Where can this be used?

  • In cases when you need to emulate a phone or any other touchscreen device
  • When you want to make all actions as close to human-like as possible.

How do I work with the action?

You need to enable “Recording” and ❗→ Input mode “Touch” in the browser window so that all actions performed in the browser will be automatically recorded as Touch events.

image-20200816-113838

Selecting the event

  • Swipe to element — scrolls the page until the element becomes visible.
  • Simple swipe — Up / Down / Left / Right.

Finding an element

Before you can interact with an element on the page, you need to find it. In actions like ❗→ Get value, ❗→ Set value, ❗→ Trigger event, ❗→ Touch event, ❗→ Swipe event there are two ways to search for elements — classic and XPath.

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

image-20200805-202115

XPath — searching with ❗→ XPath expressions. This allows you to implement a more flexible and robust way to find data compared to classic search or regular expressions.

image-20200805-202209

Which tab

Select the tab where the element will be searched for. Possible values:

  • Active tab
  • First tab
  • By name — when you select this option, an input field for the tab name will appear.
  • By number — you’ll need to enter the tab number in the input field (numbering starts from zero!)

Document

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

Form

It’s also best to set this to -1 (search in all forms on the page). Choosing this value makes your template more universal.

Why is it better to set "-1"?

For example: there are 3 forms on a page — search, registration, product order. Suppose you need to click a button in the order form and you set the “Form” field to 2 (numbering starts from zero). Later, a new login form is added to the site before the order form. Now, number 2 will refer to the login form, and your template will either throw an error that the button wasn’t found, or (even worse) click another button in the wrong form.

Note

In the program’s settings, you can check two boxes — Search in all forms on the page and Search in all documents on the page — and then, when adding an element in the Action Builder, the document and form number will always be set to -1.

Tag (classic search only)

image-20210525-095347

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

Tip

You can specify several tags at once, separated by a semicolon (;)

Conditions (classic search only)

image-20210525-100053

  1. Group — priority of this condition. The higher the number, the lower the priority. If you can’t find an element with the highest-priority condition, move to the next, and so on, until the element is found or all conditions run out. You can add several conditions with the same priority; in that case, the search will be performed using all those conditions at once.

  2. Attribute — HTML tag attribute to search by.

  3. Type of search:

  4. text — search by full or partial text match;

  5. notext — search for elements that do NOT have the specified text;

  6. regexp — search with ❗→ regular expressions.
    By default, searches are case-insensitive. If you want the regex search to be case-sensitive, add (?-i) at the very beginning of the expression (this disables case-insensitive search).

  7. Value — value of the HTML tag attribute.

  8. Match # — index number of the found element (starts from zero!). In this field, you can ❗→ use ranges and macros from ❗→ variables.

Note

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

Note

You can use several conditions to locate the desired element.

It’s always important to choose search conditions in such a way that only one element remains — i.e., the index should be 0 (indexing starts from zero).

The “Advanced” tab

“Wait before executing”.

How long the action should wait before running.

“Wait for element no more than”.

If the element doesn’t appear on the page within the specified time, the action will finish with an error.

Usage example

Works great together with ❗→ Touch. First, perform a Swipe to the element, then Touch.

It’s also useful for emulating live page scrolling or “flipping” through photos.

The article about Touch also contains ❗→ swipe examples in C#.