Skip to main content

[Mobile] Execute Mobile Command

Description

Execute a native mobile command.

Keyword name: Mobile.executeMobileCommand

Parameters

ParameterParameter TypeRequiredDescription
commandStringYesMobile command name
argsMapYesThe provided arguments for which the command is required
flowControlFailureHandlingOptionalSpecify failure handling schema to determine whether the execution should be allowed to continue or stop.

Returns

The command's result with the Object type.

If Katalon Studio could not find the specified element, throws StepFailedException.

Example

import com.google.common.collect.ImmutableMap as ImmutableMap;

Mobile.startApplication('C:\\Users\\katalon\\Sample Apps\\APIDemos.apk',
true)

String command = "mobile:changePermissions"
Map args = ImmutableMap.of(
"action", "grant",
"appPackage","com.hmh.api",
"permissions", "android.permission.READ_CONTACTS")
Object result = Mobile.executeMobileCommand(command, args)

print result

Mobile.closeApplication()