List of mobile built-in keywords

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:

List of mobile built-in keywords

Application

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:

Mobile.startApplication(‘path_of_apk_file’, true)

Mobile.closeApplication()

The path of apk such as: “E:\\Katalon\\Apk\\Uber.apk”, true option means to start the application and uninstall it after run.

Attributes

To get a specific attribute of a mobile element, you can use: Mobile.getAttribute() function.

  1. Double click on the object in Object Repository folder to see list of object attribute.
  2. Open a test case in Manual mode, right click >> Add >> Mobile Keyword.
  3. Select Get Attribute in Item column, select Object in Object column, specify name of attribute (eg: “text”)  as the first parameter in Input column.
  4. Run the test and view result in Console window.

Device

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

Notification

Katalon supports Open notification and Close notification on the current device as followings:

'Open any sudden notifications'
Mobile.openNotifications()
'Close any sudden notifications'
Mobile.closeNotifications()

Screen

You can also operate in the screen devices by Pinch to zoom out/zoom in, Swipe, Tap, Tap and Hold and so on.

Element

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

Utilities

This API allows you take the screenshots, delay, comment or verify checkpoint while running the script.

Leave a Reply

Your email address will not be published. Required fields are marked *