Why Does Scroll to Element Fail in Mobile Native Apps and How Do I Fix It??


In mobile native apps, the Scroll to Element NLP only works when the target element is already rendered within the current screen viewport. If the element exists on the page but hasn't scrolled into view yet, the NLP has no visible target to act on, causing the step to fail silently or do nothing. This article discusses how to resolve this by using a Swipe NLP before Scroll to Element to manually bring the element into the viewport first.


Swipe NLPs to Use Before Scroll to Element

Use one of the following Swipe NLPs depending on which direction you need to scroll:

NLP Effect
Swipe from middle to top on the screen Scrolls the screen upward, reveals content below the current view
Swipe from bottom to top on the screen A more aggressive scroll, reveals content further below
Swipe from top to bottom on the screen Scrolls back upward, use if you've scrolled past the element

NLPs


Steps to Use Swipe NLPs

  1. Open your test case and navigate to the step where you want to interact with an off-screen element.
  2. If you are unsure about how many scrolls are required to view the element, then use the While loop to scroll through the page.
  3. Click Step Inside Loop to add a step inside the loop. Srep Inside Loop
  4. Enter the Swipe NLP in the step action field. Swipe NLP
  5. If needed, add additional swipe steps to move the element further into view.
  6. Click Run to execute the test case and verify that the element comes into view before the scroll action. Run