Table of contents
1.
Introduction
1.1.
What is Katalon Studio?
1.2.
Features of Katalon Studio
2.
Handling Alert Dialog in Mobile App with Katalon Studio
2.1.
Login Scenario
2.2.
Manual Mode
2.3.
Script Mode
3.
Frequently Asked Questions
3.1.
Define Test Suite.
3.2.
Discuss Manual View vs Script View in Katalon.
3.3.
Which framework do we use in Katalon Studio?
3.4.
Form a basic comparison between Katalon and Selenium.
4.
Conclusion
Last Updated: Mar 27, 2024
Medium

Handling Alert Dialog in Mobile App with Katalon Studio

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

Introduction

We all must agree that testing is integral to developing web applications. It informs us whether the task is performing as per our expectations before it is launched.

Katalon, a platform for Automation Testing, is used to test web applications, APIs, and mobile and desktop applications. It is a powerful automation tool designed to generate and reuse automated test scripts for the User Interface without any need to code.

logo of Katalon

What is Katalon Studio?

Katalon Studio is a closed-source automation testing platform for web, application, and API testing. It was in 2015 for internal testing. Later, in 2016, it was released to the public.

We can create, execute, or view our reports for test automation using Katalon Studio. You require no special skills to use the Katalon Studio. It offers both the manual view and the script view. It is helpful to anyone who wants to test their software irrespective. of their experience in programming.

Features of Katalon Studio

Various special features of Katalon Studio have led to its popularity. Some prominent features are mentioned below.

  • The Katalon Studio covers everything a tester needs in a single and organized package. This makes its deployment very easy.
  • The Katalon Studio is simple to install with no tedious processes involved.
  • As mentioned above, it is not compulsory for you to require any specific specialized skill to work with Katalon Studio.
  • You can complete every stage, from organizing the project, creating the tests, and running the tests, to producing the final report using in-built example copies and giving a few instructions. This helps you achieve faster results.


In detail, this article will discuss the process of Handling Alert Dialog in Mobile App with Katalon Studio. So, without further ado, let’s start.

Handling Alert Dialog in Mobile App with Katalon Studio

An Alert Dialog box is used to send alert messages to the user. It consists of a specific message to be given to the user, and two options, Ok or Cancel, to accept or reject the message respectively. This module explains the process of Handling Alert Dialog in Mobile App with Katalon Studio using examples and relevant images.

There are two ways to perform multi-touch actions in Mobile App with Katalon Studio- Manual Mode and Script Mode.

Login Scenario

We have used a sample application to learn the process. You can use this same application or go for a different one. If you want to use the same application, open this link. Select the application and open Alert Dialogs.

The screenshot below shows an example of an Alert Dialog. We aim to handle the dialog that generally appears on a mobile application if it detects any suspicious or dangerous activity.

example alert dialog box

Manual Mode

This is the first way for Handling Alert Dialog in Mobile App with Katalon Studio. To complete the process accurately, follow these steps properly.

1. Start the Application and click on Input to open a window. The image below shows the window that appears.

parameters' screen

2. Carefully understand the available parameters, their type, and their value type. Figure out what values you can pass. 

3. Click Ok.

4. A screen appears where you will have to add the required number of items. The image below shows the screen that appears. These items influence your experience while Handling Alert Dialog in Mobile App with Katalon Studio.

A new test case screen looks like this.

new test case screen

5. Now, add a few items, as shown in the image below. Carefully pass the required Objects, Inputs, and descriptions.

Items' screen

6. Call Scroll to Text method and pass the input as ‘Alert Dialogs’. 

7. Check if any App or Alert Dialogs are present using the Wait for Element Present keyword and verify it using Verify Element Visible method.

8. Again, call Scroll to Text method and pass the input as ‘Ok Cancel dialog with traditional theme’.

9. Use the Tap method to pass the object ‘Ok Cancel dialog with traditional theme’.

10. Check for the element present using Wait for Element Present keyword and verify it using Verify Element Visible method.

11. After successfully adding the element above, you will see a screen like this.

updated items' screen

12. Call the Get Text method to capture the text of Alert Dialog. After capturing, store it in a variable name actual_AlertText.

13. Now match the expected and original values using Verify Match method.

14, Call the Tap method and pass input as ‘Ok’.

15. Close the application.

Script Mode

This is the second way for Handling Alert Dialog in Mobile App with Katalon Studio. Enter the code below in the editor to proceed.

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Demo
import com.kms.katalon.core.model.FailureHandling as FailureHandling

'Path of the Apk File Store in path variable.'
def path = RunConfiguration.getProjectDir() + '/Data Files/ApiDemos.apk'
'Starting the application.'
Demo.startApplication(path, false)

'Waiting for element Present of Heading API Demos.'
Demo.waitForElementPresent(findTestObject('API Demos Objects/Article_4/heading_API_Demos'), 50)

'Scroll to App text'
Demo.scrollToText('App', FailureHandling.STOP_ON_FAILURE)

'Tap on App'
Demo.tap(findTestObject('API Demos Objects/Handle Alert/text_App'), 25)

'Scroll to Alert Dialogs text'
Demo.scrollToText('Alert Dialogs', FailureHandling.STOP_ON_FAILURE)

'Tap on Alert Dialogs'
Demo.tap(findTestObject('API Demos Objects/Handle Alert/text_Alert Dialogs'), 35)

'Wait for Element Present of Header Alert'
Demo.waitForElementPresent(findTestObject('API Demos Objects/Handle Alert/text_Header Alert'), 35)

'Verify Element Visible of Header Alert'
Demo.verifyElementVisible(findTestObject('API Demos Objects/Handle Alert/text_Header Alert'), 35)

'Scroll to "OK Cancel dialog with traditional theme"'
Demo.scrollToText('OK Cancel dialog with traditional theme', FailureHandling.STOP_ON_FAILURE)

'Tap On Button OK Cancel dialog with traditional theme'
Demo.tap(findTestObject('API Demos Objects/Handle Alert/button_OK Cancel dialog with traditional theme'), 35)

'Wait for Element Visible of Alert Title'
Demo.waitForElementPresent(findTestObject('API Demos Objects/Handle Alert/text_Alert Title'), 35)

'Verify the Element Visible of Alert Title'
Demo.verifyElementVisible(findTestObject('API Demos Objects/Handle Alert/text_Alert Title'), 35)

'Get the Alert Title text and Store in to "actual_AlertText" variable'
actual_AlertText = Mobile.getText(findTestObject('API Demos Objects/Handle Alert/text_Alert Title'), 30)

'Verify the actual and Expected Alert Texts'
Demo.verifyMatch(actual_AlertText, "Lorem ipsum dolor sit aie consectetur adipiscing\nPlloaso mako nuto siwuf cakso dodtos anr koop.",false)

'Tap on OK Button on Alert'
Demo.tap(findTestObject('API Demos Objects/Handle Alert/button_OK'), 35)

Frequently Asked Questions

Define Test Suite.

A Test Suite is a group of Test Cases. If you want to manage or regulate some test cases similarly, you can group them in a Suite. In this way, you can change the behavior of all the test cases by changing the setting of a Suite.

Discuss Manual View vs Script View in Katalon.

The Manual View is quite basic. It allows you to use simple keyword-driven configuration for generating automated tests and, thus, requires no coding.

The Script View is specially designed for advanced users and programmers. They must be familiar with modifying and writing test scripts using Groovy or Java.

Which framework do we use in Katalon Studio?

We use the Groovy framework in Katalon Studio. Groovy is a Java-based framework that requires the loading of several libraries. These libraries are used to parse test data, objects, and logging.

Form a basic comparison between Katalon and Selenium.

Selenium is a bit faster than Katalon Studio. This is because Katalon Studio uses a Java-based Groovy framework. This framework loads much more test objects and libraries.

Conclusion

Overall, we understood the process of Handling Alert Dialog in Mobile App with Katalon Studio. We also learned in brief about Katalon Studio. 

We hope the above discussion helped you understand the process of Handling Alert Dialog in Mobile App with Katalon Studio and can be used for reference whenever needed. To learn more about Katalon Studio and its components, you can refer to blogs on Installing Katalon StudioLooping Statements in Katalon StudioKatalon Studio vs ACCELQKatalon Studio vs Ready API, and Keyboard Shortcuts in Katalon Studio.

Visit our website to read more such blogs. Make sure you enroll in our courses, take mock tests, solve problems, and interview puzzles. Also, you can pay attention to interview stuff- interview experiences and an interview bundle for placement preparations. Do upvote our blog to help fellow ninjas grow.

Happy Coding!

Live masterclass