Table of contents
1.
Introduction
2.
Swipe Horizontally from Left to Right
3.
Scenario
4.
Manual Mode
5.
Script Mode
6.
Test Cases
7.
Frequently Asked Questions
7.1.
Is Katalon Studio better than Selenium?
7.2.
Is Katalon Studio still free?
7.3.
Does Katalon support mobile automation?
7.4.
Can we automate mobile device testing?
7.5.
Does Katalon use Appium?
8.
Conclusion
Last Updated: Mar 27, 2024

Handling Horizontal 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 Horizontal Swipe in Mobile Automation with Katalon Studio

Swipe Horizontally from Left to Right

In this blog, we will learn about Horizontal Swiping actions with the help of an example. This action is for mobile app automation from left to right. Here we will use the SwipeListView demo. 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 that has a list of applications. These were installed on the device(mobile). We must swipe in the direction left to right, i.e., horizontally. It can be on any list application. 

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: Call a method Wait For Element Present after the application is launched. Capture the 'alert_Status' variable status of an Alert. When an alert is present, it returns true; otherwise, it returns false.

Step 3: Add an if statement. If the value of  'alert_Status' is true, click "Don't show this message again". Finally, click on OK.

Step 4: To verify the popping up of mobile elements, add another item, Wait For Element Present.

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: Create a binary statement by dividing the "startY" by 2. The y-coordinates are fixed here.

Step 7: Add a binary statement, as the values for "endY" and "startY" for horizontal swiping are the same. So, reassign "startY" to "endY".

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

Step 9: Add a binary statement and multiply the device width by 0.70. It will store it in the "endX" 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).

Note: To implement the swipe from right to left horizontally will have a similar process as above. 

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
 
def path = RunConfig.getProjectDir() + '/Data Files/SwipeListView Demo.apk'
 
Mbl.startApplication(path, false)
alert_Status = Mbl.waitForElementPresent(findTestObject('Swipe ListView Demos/checkbox_Dont show this message again'),20)
 
if (alert_Status == true) {
    Mbl.tap(findTestObject('Swipe ListView Demos/checkbox_Dont show this message again'), 30)
    Mbl.tap(findTestObject('Swipe ListView Demos/button_Ok'), 30)
}
 
Mbl.waitForElementPresent(findTestObject('Swipe ListView Demos/header_text SwipeListView Demo'), 45)

device_Height = Mbl.getDeviceHeight()
device_Width = Mbl.getDeviceWidth()
 
int startY = device_Height / 2
int endY = startY
int startX = device_Width * 0.30
int endX = device_Width * 0.70
 
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 horizontally from Left to Right and Swiping horizontally from Right to Left.

 

Test Cases/Swipe Horizontal Left to Right.tc

<?xml version="1.0" encoding="UTF-8"?>
<TestCaseEntity>
   <description></description>
   <name>Swipe Left to Right Horizontally</name>
   <tag></tag>
   <comment></comment>
   <testCaseGuid>a2657843-6eab-4e3b-ac04-034fb8c61488</testCaseGuid>
</TestCaseEntity>

 

Test Cases/Swipe Horizontal Right to Left.tc

<?xml version="1.0" encoding="UTF-8"?>
<TestCaseEntity>
   <description></description>
   <name>Swipe Right to Left Horizontally</name>
   <tag></tag>
   <comment></comment>
   <testCaseGuid>fbd4351b-2861-4aae-9dc2-d99b230d60be</testCaseGuid>
</TestCaseEntity>

Frequently Asked Questions

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 Studio still free?

The free plan of Katalan Studio is suitable for individuals and small teams. The Premium plan is best for large teams or SMBs who need different test results and have production-grade testing workloads. 

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.

Can we automate mobile device testing?

Yes, we can automate mobile device testing. Katalon offers a ready-made testing platform for web, mobile, and desktop applications. It supports both iOS and Android testing. 

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.

Conclusion

This complete article has helped us to learn about all the concepts and steps for handling Horizontal Swipe in mobile automation. We have learned step-by-step procedures for handling horizontal swiping 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 image
Live masterclass