Block reference / UI Interaction
Swipe & check screen
Swipe until something shows, or swipe once and say whether the list has ended.
Only in
WarpX Phone
Swipe & check screen does the two things a long list needs. In one mode it swipes until an element, some text or a picture shows, and answers true when it did. In the other it swipes once and answers true when nothing moved, which means the end of the list, so a loop can stop there. For one plain swipe, use Swipe / Scroll.
true.Settings
- Mode
Swipe until something shows looks first and swipes only while it is not there. Swipe once, and check for the end of the list swipes one time and compares the screen before and after.
ExampleSwipe until something shows- Swipe
Which way the finger moves: Up (on through a list), Down (back towards the top), Left (the next page to the right) or Right (the page before).
ExampleUp — the content moves on, as reading down a list- Look forwhen Mode is Swipe until something shows
An element — by locator or XPath uses Selector, Text in the screen's elements uses Text it contains, and A picture uses Picture.
ExampleText in the screen's elements- Text it containswhen Look for is Text in the screen's elements
Text that some element on screen contains, ignoring case.
ExampleWireless Earbuds Pro- Picturewhen Look for is A picture
The picture to find. Capture opens the phone's screen to draw a box round it; Clear removes it, and Edit as text shows what it is stored as.
Example{ "template": "iVBOR…", "sourceWidth": 1080 }- Swipe up to (times)when Mode is Swipe until something shows
The most swipes to make before giving up, from
0to200. The default is10.Example15- Fail when it never showswhen Mode is Swipe until something shows
On, the block fails with
Not found after 15 swipeswhen the swipes run out. Off (the default), it answersfalseand goes on.ExampleUnchecked- Swipe duration (ms)
How long each swipe takes, from
50to5000.Example400- Selectorwhen Look for is An element — by locator or XPath
The element to act on. Inspect opens the Inspector for the phone picked in the editor's toolbar: pick the element, then Use in block for its locator, which still finds the element after the app changes, or Use XPath. You can also write an XPath such as
//android.widget.Button[@text='Sign in'], or plain text, which means the element whose text is exactly that; Verify looks for it on the phone now and says whether it found one, several or none.Example//android.widget.TextView[@text='Wireless Earbuds Pro']- Save the answer (true / false) to a variable
Also stores the answer,
trueorfalse, in a workflow variable.ExampleChecked- Variable namewhen Save the answer (true / false) to a variable is on
The variable to write. Later blocks read it as
{{variables.earbudsShown}}, for example in a Conditions path.ExampleearbudsShown- Delay (ms)
A pause after the block finishes, before the next block starts. Write one number such as
1000, or a range such as1000,3000for a random pause in that range on each run.Example0
Every block also has the shared block settings — a description, Disable block and what to do on an error, and Finding elements on a phone explains selectors, Inspect and Verify in more depth. Fields that take text accept data from earlier blocks.
What it hands on
Hands on true or false as {{prevBlockData}}, and writes it to the variable when asked: whether it showed, or whether the list had ended. Leaves by its single output either way; branch on the answer with Conditions.
Example: Scroll a product list until one product shows, then open it
- Start
- Swipe & check screen
- Conditions
- Touch
- Pick the phone in the editor's toolbar and open the product list in the shop app.
- Add a Swipe & check screen block with Mode Swipe until something shows and Swipe Up.
- Set Look for to Text in the screen's elements and Text it contains to
Wireless Earbuds Pro, and Swipe up to (times) to15. - Tick Save the answer (true / false) to a variable and name it
earbudsShown. - Add a Conditions block with a path
{{variables.earbudsShown}}Equalstrue, connected to a Touch on the product. - Press Run: the list scrolls until the product shows, and the run opens it.
Good to know
- Swipe until something shows looks before the first swipe, so it does not swipe at all when the thing is already there. After each swipe it waits about 600 ms for the list to settle before looking again.
- The swipes run through the middle of the screen: from 75% to 25% of its height for Up, from 80% to 20% of its width for Left, and the other way for Down and Right.
- Swipe once, and check for the end of the list compares the text on screen and where it sits, before the swipe and about 700 ms after.
truemeans nothing moved. In a Loop data or While loop over a list, stop when it saystrue. - Looking for an element or text, and the end-of-list mode, need the WarpX agent. Looking for a picture does not; it uses a likeness of 0.8, over the whole screen.
- What Selector accepts: anything starting with
/or(/is an XPath, evaluated as full XPath 1.0 over the screen's elements with the attributes Appium uses (text,resource-id,content-desc,class,package,boundsand flags such asclickable), socontains()andstarts-with()work. Text starting with{or[is read as JSON: the locator Use in block writes, or a selector such as{"res": "com.example.shop:id/search_box"}. Anything else is the exact, case-sensitive text of an element. There is notext=orid=shorthand:text=Sign inlooks for an element whose text istext=Sign in.
See also
- Swipe / Scroll — Swipe between two points of the screen, or scroll a list one page.
- Find text (dump) — Look for text among the screen's elements, and say whether it is there or tap it.
- Element exists — Whether an element is on the phone's screen: true or false.
- Image search — Find a picture on the phone's screen, then tap it, wait for it or say whether it is there.