Table of contents
1.
Introduction
2.
Swipe Vertically from Top to Bottom
3.
Scenario
4.
Manual Mode
5.
Script Mode
6.
Test Cases
7.
Frequently Asked Questions
7.1.
What is Katalon Studio used for?
7.2.
Does Katalon use Appium?
7.3.
Is Katalon Studio better than Selenium?
7.4.
Is Katalon suitable for automation?
7.5.
Does Katalon support mobile automation?
8.
Conclusion
Last Updated: Mar 27, 2024

Handling Vertical Swipe in Mobile Automation with Katalon Studio

Author Aditi
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Have you ever worked with any automated testing software tools? 

This article is focused on one of these automated testing software tools, i.e., Katalon Studio. Katalon Studio is built on the open-source Selenium and Appium automation frameworks. It has a specialized IDE interface for API, mobile, web, and desktop application testing. It is an automation tool for mobile and web application testing. It can be installed easily. It can quickly run, create, maintain and report its automated tests. Katalon Studio is designed to reuse and create automated test scripts without coding. It allows the execution of automated tests for UI elements. It includes iFrames, pop-ups, and wait time. Linux, macOS, and Microsoft Windows all support launching the tool.

Let's dive into the article to learn more about  Mobile Automation Testing with Katalon Studio.

Handling Vertical Swipe in Mobile Automation with Katalon Studio

Swipe Vertically from Top to Bottom

In this article, we will learn about Vertical Swiping actions with the help of an example. This action is for mobile app automation from top to bottom. Here we will use the API Demos. Also, we will use Android OS throughout the article. So, you need to ensure that the Android device API you have should be greater than 18.

Scenario

Let's assume a scenario to proceed further. There is an app with an 'n' number of rows listview. We have to swipe in the direction from top to bottom, i.e., vertically. We aim to swipe the mobile screen vertically. 

Manual Mode

Step 1: Select from the mobile keyword Start Application. Click on Input. A window will appear on the screen. Choose Value Type as a Variable in appFile. Pass the path as the variable name in Value.

Step 2: Add an item Wait For Element Present.

Step 3: From the mobile keyword, call Scroll To Text. Pass ‘Views’ as input. String type parameters are accepted by Scroll To Text (Text of the element that is to be scrolled).

Step 4: Click on Views.

Step 5: For capturing the device's height, use the keyword Get Device Height. It will store the height in a variable named deviceheight. Similarly, use the keyword Get Device Width to capture the device's height. It will store the width in a variable named deviceWidth.

Step 6: Add a binary statement, and the device width divided by 2 is stored in the "startX" value. The X-coordinates in this example will not change.

Step 7: Add the binary statement. Give "startX" the value "endX".

Step 8: Add the binary statement and multiply the device height by 0.30. It will store it in the "startY" variable.

Step 9: Add a binary statement and multiply the device height by 0.70. It will store it in the "endY" variable.

Step 10: Call the swipe method. Choose "Variable" for the Value Type. To that method, pass the startX, startY, endX, and endY variables.

Script mode makes it possible to follow the above step-by-step instructions (Click on the Script tab to switch to Script Mode).

Script Mode

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.configuration.RunConfiguration as RunConfig
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mbl
import com.kms.katalon.core.model.FailureHandling as ErrorHandler
 
def path = RunConfig.getProjectDir() + '/Data Files/ApiDemos.apk'
Mbl.startApplication(path, false)
 
Mbl.waitForElementPresent(findTestObject('API Demos Objects/heading_API_Demos'), 45)
Mbl.scrollToText('Views', ErrorHandler.STOP_ON_FAILURE)
Mbl.tap(findTestObject('API Demos Objects/text_Views'), 20)

device_Height = Mbl.getDeviceHeight()
device_Width = Mbl.getDeviceWidth()
 
int startX = device_Width / 2
int endX = startX
int startY = device_Height * 0.30
int endY = device_Height * 0.70
 
'Swiping from top to bottom Vertically.'
Mbl.swipe(startX, endY, endX, startY)
 
'Swiping from bottom to top Vertically.'
Mbl.swipe(startX, startY, endX, endY)

Test Cases

There are test cases given in the GitHub of katalon-mobile-automation. There are different test cases for Swiping vertically from Top to Bottom and Swiping vertically from Bottom to Top.

Test Cases/Swipe Vertical top to bottom.tc

<?xml version="1.0" encoding="UTF-8"?>
<TestCaseEntity>
   <description></description>
   <name>Swipe top to bottom Vertically</name>
   <tag></tag>
   <comment></comment>
   <testCaseGuid>4748eec9-3547-4e92-8076-1eed9b3c2840</testCaseGuid>
</TestCaseEntity>

 

Test Cases/Swipe Vertical bottom to top.tc

<?xml version="1.0" encoding="UTF-8"?>
<TestCaseEntity>
   <description></description>
   <name>Swipe bottom to top Vertically</name>
   <tag></tag>
   <comment></comment>
   <testCaseGuid>ec81d763-3dcc-441c-b6e8-205d4193245d</testCaseGuid>
</TestCaseEntity>

Frequently Asked Questions

What is Katalon Studio used for?

Katalon is used to create and reuse automated test scripts for UI without coding. It allows running automated tests of UI elements. It can be launched on Microsoft Windows, macOS, and Linux.

Does Katalon use Appium?

Katalon acts as a Self-regulation tool for both Web and Mobile Applications. It does the e job of both Selenium and Appium.

Is Katalon Studio better than Selenium?

Selenium is faster than Katalon studio. The reason behind it is the scripting language. Katalon uses Groovy, which is built on Java. So it has to load more libraries, test objects, etc. The difference in performance and speed will be noticeable if the test is very long.

Is Katalon suitable for automation?

Katalon is a good tool for test automation, both for APIs and Web Pages. 

Does Katalon support mobile automation?

Yes, Katalon Studio supports mobile automation. Katalon is built above Selenium and Appium.  So, it is a ready-to-use vendor-based tool and ready-made test automation platform for web, API, mobile, and desktop (Windows) apps.

Conclusion

This complete article has helped us to learn about all the concepts and steps for handling Vertical Swipe in mobile automation. We have learned step-by-step procedures for handling vertical swipes in mobile automation using Katalon Studio.

We hope this blog has helped you enhance your  Mobile Automation Testing with Katalon Studio knowledge. Check out our articles to know more about the introduction to API and its usageWeb API introduction, and real-world API. Practice makes a man perfect. To practice and improve yourself in the interview, you can check out Top 100 SQL problemsInterview experienceCoding interview questions, and the Ultimate guide path for interviews.

Do upvote our blog to help other ninjas grow. Happy Coding!

thank you
Live masterclass