Block reference / UI Interaction

Swipe / Scroll

Swipe between two points of the screen, or scroll a list one page.

Only inWarpX Phone

Swipe / Scroll moves what is on screen: a feed, a product list, a carousel, a picture gallery. With Coordinates it drags a finger from one point to another, which works on anything, a game included. With Element it asks a list, found by its selector, to scroll one page forward or back. To swipe until something shows, or to tell when a list has ended, use Swipe & check screen.

A swipe from 80% of the way down to 30% moves the feed on to the next posts.
The Swipe / Scroll block's settings, filled in as in the example below.

Settings

Target

Element (where a new block starts) scrolls the list that holds the element in Selector. Coordinates swipes from From X, From Y to To X, To Y.

ExampleCoordinates
Scroll the listwhen Target is Element

Forward (down / right) shows what comes next in the list; Back (up / left) goes back towards its start.

ExampleForward (down / right)
Selectorwhen Target is Element

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. The element can be the list itself or anything inside it: the nearest list around it is scrolled.

Example//androidx.recyclerview.widget.RecyclerView[@resource-id='com.example.shop:id/product_list']
Wait up to (ms)when Target is Element

How long to keep looking for the element before the block fails, in milliseconds. The most is 120000.

Example10000
Scroll to find element (times)when Target is Element

When the list is not on screen yet, scroll the screen's main list and look again, up to this many times (at most 50), before scrolling the one the selector names. 0 looks only where the screen is now.

Example0
Coordinateswhen Target is Coordinates

How the points are written: Share of the screen (0 – 1), the same on any phone, or Pixels of this phone's screen.

ExampleShare of the screen (0 – 1)
From Xwhen Target is Coordinates

Where the finger goes down, across from the left. Pick beside it opens the phone's screen in the Inspector: click a point, or drag a whole swipe to fill both ends at once.

Example0.5
From Ywhen Target is Coordinates

Where the finger goes down, from the top. The default swipe starts at 0.75.

Example0.8
To Xwhen Target is Coordinates

Where the finger lifts, across. Pick beside it sets this end alone.

Example0.5
To Ywhen Target is Coordinates

Where the finger lifts, from the top. A finger moving up the screen, as here, moves a feed on to the next posts.

Example0.3
Duration (ms)when Target is Coordinates

How long the finger takes, from 1 to 10000. Short swipes fling a list further; long ones drag it about as far as the finger moved.

Example400
Delay (ms)

A pause after the block finishes, before the next block starts. Write one number such as 1000, or a range such as 1000,3000 for a random pause in that range on each run.

Example1500,3000

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 nothing. Leaves by its single output.

Example: Scroll through a feed, five screens

  1. Start
  2. Loop data
  3. Swipe / Scroll
  4. Loop breakpoint
Where Swipe / Scroll sits in the example workflow.
  1. Pick the phone in the editor's toolbar and open the feed you want to scroll.
  2. Add a Loop data block with Loop through set to Numbers, from 1 to 5.
  3. Add a Swipe / Scroll block, set Target to Coordinates and leave Coordinates on Share of the screen (0 – 1).
  4. Set From X 0.5, From Y 0.8, To X 0.5, To Y 0.3 and Duration (ms) 400.
  5. Set Delay (ms) to 1500,3000, so each screen stays a little while, and close the loop with a Loop breakpoint.
  6. Press Run and watch the feed move on five times.

Good to know

  • With Share of the screen (0 – 1), every value must lie between 0 and 1, or the block fails naming the field.
  • Coordinates work on any phone adb can drive. Element needs the WarpX agent.
  • With Element, the list is asked to scroll one page. At the end of the list the phone usually refuses, and the block fails with The phone refused scrollForward; use Swipe & check screen in its Swipe once, and check for the end of the list mode to stop a loop there instead.
  • 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, bounds and flags such as clickable), so contains() and starts-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 no text= or id= shorthand: text=Sign in looks for an element whose text is text=Sign in.
  • When the block fails, it leaves by its fallback output if one is connected: a phone block comes with On error set to Execute fallback. With nothing connected there, the workflow's On workflow error setting decides.

See also

  • Swipe & check screen — Swipe until something shows, or swipe once and say whether the list has ended.
  • Element action — Tap, click, long-press, type into, clear, scroll or focus an element.
  • Touch — Tap, hold or double-tap an element on the phone's screen, or a point on it.