In this post, I will give several examples of Katalon mobile built-in keywords. You can also see Katalon docs for more details.
Katalon provides many libraries and built-in keywords, making it a flexible and powerful script, including group of libraries for Application operations, Device handles, Elements, Notifications, Screens, Text and so on.
The figure below depicts the names of the library groups:
Start application and close are two actions indispensable in the script. Click on a test case and view in Script mode, then we add two line of code into the script as below:
The path of apk such as: “E:\\Katalon\\Apk\\Uber.apk”, true option means to start the application and uninstall it after run.
To get a specific attribute of a mobile element, you can use: Mobile.getAttribute() function.
- Double click on the object in Object Repository folder to see list of object attribute.
- Open a test case in Manual mode, right click >> Add >> Mobile Keyword.
- Select Get Attribute in Item column, select Object in Object column, specify name of attribute (eg: “text”) as the first parameter in Input column.
- Run the test and view result in Console window.
Provides some functions to operate in devices while running test, for example:
- Get Current Orientation
- Get Device Height/Width
- Get Device OS/ OS version
- Switch to Landscape/Portrait
- Verify Is Landscape/Portrait
- Unlock Screen
Katalon supports Open notification and Close notification on the current device as followings:
'Open any sudden notifications'
'Close any sudden notifications'
You can also operate in the screen devices by Pinch to zoom out/zoom in, Swipe, Tap, Tap and Hold and so on.
Provides functions to handle elements, for instance:
- Hanle events: Drag And Drop, Tap & Hold, Check & Uncheck
- Get Element Height/Width
- Verify attributes
- Wait for element present/visible
This API allows you take the screenshots, delay, comment or verify checkpoint while running the script.