How-to
Store text (storeText)
Store text (storeText)
Reads the visible text of Target and stores it under the name in Value. Later steps of the same job substitute that name as <<stored:name>>.
Step model
action_name | storeText |
| Group | Expect |
| Target | Required |
| Value | Required (stored_name) |
| expected_value | Used |
| TEST_ACCOUNT | Forbidden |
| Do not confuse with | toHaveText |
Target/Value facts match the source-of-truth catalog and Autotest step.
Prerequisites
- The element with text is already visible.
- The name is not used yet in this job, or you mean to overwrite it.
Steps
- Add a
storeTextstep. - Set Target to the element whose text you want to keep.
- In Value enter a name: a lowercase letter, then lowercase letters, digits, or
_, at most 64 characters. Do not wrap it in<< >>. - To keep only part of the text, put a pattern in the expected value: literals and exactly one
(\d+)or([a-z0-9_]+)group. Write parentheses around a number as\((\d+)\). - Save. In a later step use
<<stored:name>>inside Value or a locator.
The step is stored on the autotest. Next - neighbouring steps or autotest run creation.
Examples
The number on the Opened tab
Fields in the UI:
| Field | Value |
|---|---|
action_name | storeText |
| Target | kind ROLE, value tab, name Opened |
| Value | opened_before |
| value_source_type | INLINE |
| expected_value | \((\d+)\) |
Step JSON fragment (copy-paste):
json
{
"action_name": "storeText",
"target": {
"kind": "ROLE",
"value": "tab",
"name": "Opened"
},
"value_text": "opened_before",
"value_source_type": "INLINE",
"expected_value": "\\((\\d+)\\)"
}Common mistakes
- The name in Value is not a token. Write
<<stored:opened_before>>in later steps. - A pattern such as
(a+)+is not saved and is not executed. Literals and one(\d+)or([a-z0-9_]+)group are allowed. <<stored:…>>inside the pattern is forbidden.<<param:…>>,<<const:…>>, and<<random:…>>are checked on the substituted string when the job runs.- If the pattern matches nothing, the step is
FAILED. If the name is not stored yet when a later step reads it, that step isERRORand is not retried. - Captured text longer than 500 characters is not stored: the step is
ERROR.
Screenshots
Screenshots of the step form for storeText will be added here in a separate pass.
Did this page help?