Imagine the following, you have text in your application and you want to validate that it appears on another page, or you may have a value that you want to use in some calculation at a later step.
If you answered yes to any of these questions, you came to the right place.
Let's see how we can easily extract text and use it...
Click here to run a sample demo of the example below.
How to add
- Hover over the arrow menu where you want to add your validation.
- Click ‘M’ ⇒ Actions tab ⇒ ‘Add extract value step’.
- Select the element you want to extract the value from your app.
- Open the Properties panel and change the name of your variable. The default name will be "value".
Note: If you get the message "No app to choose an element from", this means that your application is closed, and you must first get the application to the desired state (by either clicking record or run the test to that step).
- By default, the mode is to extract the entire string
- Change to either Number/Date/Regular Exp if you would like to extract only just part of the text
- Please note that even when extracting Number/Date/Regular Exp the value will be a string
In the example below only the number (18) will be extracted to the parameter value
- By default the variable scope will be set to "Test" when using an extract value step
- If you would like to change it click on the "Properties Panel" of the extract value step
- Click on "Variable Scope" dropdown and you can select from three options.
You can use your new parameter in a validation step, set text, custom steps, etc.
In the example below, we'll use it to validate text on another page.
- Record text validation. (Learn more about text validation here)
- Open the properties panel of the text validation step.
- Replace the constant value typed in the Expected value field with the parameter you created.
Updated over 1 year ago