Getting value (ZD)
Table of contents
Description
This action is used to obtain the attribute value from the specified element. It can be:
height\width
Internal text
center coordinates
Id element
and etc.
How to add an action to the project?
Through the context menu of Add Action → Android → Get value
Through actions designer.
Or use smart search.
How to choose an element for getting a value?
Imagine that you need to know the coordinates of the "Play Market" label. To do this, right-click on this button and select the action “To the action designer” from context menu.
Below, the action designer will open under the browser window
The search data will be automatically selected in such a way that only one element will remain as a result of the search. Your actions:
In the Action area select Get(1) (receive).
The coordinates are stored in the bounds attribute: in the first square brackets there are coordinates of the upper left angle of the element, and in the second brackets - the right lower corner.
Select the bounds from the Attribute drop-down list(2). In the value field will appear -[530,120][750,253]
(In your case, the coordinates may differ).Before adding an action to the project, it will not be superfluous to test its operation by pressing the appropriate button (especially if you made changes in the Action Designer).
(Optional, but preferably) Add a comment to action (because Comment by default is extremely little informative)
Add an action to the project by clicking the Add to project button
What is it used for?
Checking the presence of an item on the page. It can be useful for:
definition is authorized whether we (for example, when the user is authorized in the application, the transition button to the personal account appears, if it is, it means everything is OK. Or vice versa when the user is authorized, then some element disappears, as an option - the "Login" button, if not, then we are logged in)
search for error messages (very useful when solving a captcha: if the captcha was solved incorrectly, then very often a new element appears with an error text; if, after sending the captcha, a page with such an element is returned, then we try to solve the captcha again)
Action Setup: Main Tab
After adding the action to the project via the Action Designer, open its settings:
What to take
List of available attributes for reading.
Classic item search
Action Setting: More Tab
Usage example
Let's look at one of the ways to use it. Using the Google Play app as an example.
Let's say we want to check if a user is authorized on Google Play. First you need to run the application. This can be done in several ways:
using the Rise Event action
or by using the Utils action and its Open Application subfunction
Let's use the second method.
If the user is not authorized, a window with the "Login" button will open (IMPORTANT: if you changed the language of the virtual machine, the text will be displayed in the language you selected!)
We will search for this button by two criteria at once. Search conditions in the screenshot below:
If the action succeeds (it was possible to find the button and get the value from the attribute), then the user is not authorized.
If the action fails (the button is not found), then it is authorized.