How do I scroll down on mobile? (No "Swipe" keyword?)

I’m working on my first mobile test for our Android and iOS banking app. Everything was going great until I realized the “Logout” button is at the very bottom of the profile page. I can’t click it because it’s off-screen, and when I look through the list of built-in keywords in Katalon, I don’t see a simple “Swipe” or “Scroll” command anywhere!

I tried using WebUI.scrollToElement, but then I realized that’s for web browsers, not mobile apps. Then I found Mobile.scrollToText, but it’s really hit-or-miss—sometimes it finds the text, and sometimes it just sits there. I tried to manually drag my mouse in the Mobile Recorder, but that didn’t generate any code. How are you supposed to move the screen down in a mobile app if there isn’t a “Swipe” button to use?

Hi there, and thanks for posting in the Katalon community! :hugs:

To help you faster, please review our guide on Swipe here:

Double-checking the steps and configurations might resolve the issue.

If the doc doesn’t help, feel free to provide more details, and a community member will assist you soon. Thanks for being a part of our community!

Best,
Elly Tran

You’ve hit a common point of confusion. In mobile automation (Appium, which powers Katalon), “swiping” isn’t a single button because it’s actually a coordinate-based gesture. You have to tell the phone exactly where to put its “finger” down and where to lift it up.

While Mobile.scrollToText is okay for simple lists, it often fails on complex banking layouts. Professional mobile architects use the Mobile.swipe keyword, which requires four coordinates: Start X, Start Y, End X, and End Y. To make this work on all screen sizes (from a small iPhone SE to a giant Galaxy Ultra), we use percentages of the screen height and width rather than fixed pixels.

The Solution: Percentage-Based Swiping

To swipe “down” (which actually moves the screen “up” to reveal the bottom), you start your touch at the bottom of the screen (e.g., 80% height) and move your finger toward the top (e.g., 20% height).

Custom Keyword Helper: The Universal Scroller

This keyword calculates the screen size automatically and performs a perfect vertical swipe, ensuring your “Logout” button is brought into view every time.

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import io.appium.java_client.AppiumDriver

class MobileHelper {

    /**
     * Swipes the screen vertically
     * @param direction "down" to see bottom content, "up" to see top content
     */
    @Keyword
    def smartSwipe(String direction) {
        // Get device screen dimensions
        int device_Height = Mobile.getDeviceHeight()
        int device_Width = Mobile.getDeviceWidth()
        
        int startX = device_Width / 2  // Middle of screen width
        int startY, endY

        if (direction.equalsIgnoreCase("down")) {
            // Start at bottom, move to top
            startY = (int) (device_Height * 0.80)
            endY = (int) (device_Height * 0.20)
        } else {
            // Start at top, move to bottom
            startY = (int) (device_Height * 0.20)
            endY = (int) (device_Height * 0.80)
        }

        // The swipe duration is in milliseconds (500-1000 is usually best)
        Mobile.swipe(startX, startY, startX, endY)
    }
}

How to use it in your Script:

// 1. Swipe down to bring the bottom of the page into view
CustomKeywords.'MobileHelper.smartSwipe'("down")

// 2. Now the button is visible and interactable
Mobile.tap(findTestObject('Object Repository/Mobile/btn_Logout'), 5)

hi @dgreen

Mobile.swipe is the keyword you need. It takes four coordinates: startX, startY, endX, endY. To scroll down (reveal content below), you swipe from a lower Y to a higher Y.

the trick is using screen percentages instead of hard pixels so it works across devices:

int height = Mobile.getDeviceHeight()
int width = Mobile.getDeviceWidth()

// Swipe down to reveal bottom content
Mobile.swipe(width / 2, height * 0.8, width / 2, height * 0.2)

wrap that in a custom keyword if you use it often. The 500ms default duration usually works, but if the scroll overshoots on slower devices, lower the distance between start and end Y values.

Mobile.scrollToText is worth retrying too if you give it a longer timeout. It tends to fail silently when the list is lazy-loaded and the text literally does not exist in the DOM yet. Try Mobile.scrollToText(“Logout”, 30) with a higher second parameter.