Does work profile (enterprise) - userProfile supported in katalon?

does work profile (enterprise) - userProfile supported in katalon?
i tried to add userProfile in desired capabilities but app does not launch

C:\Users\tester>adb shell pm list users
Users:
UserInfo{0:Owner:13} running
UserInfo{10:Work profile:50100030} running

katalon desired capabilities
userProfile : 10

when i use cmd adb and app launch successfully.
what is the additional argument i need to setup in katalon?

C:\Users\tester>adb shell am start --user 10 -n “com.ninetest.hd3.work.cac/com.ninetest.hd3.activity.MailActivityEmail”
Starting: Intent { cmp=com.ninetest.hd3.work.cac/com.ninetest.hd3.activity.MailActivityEmail }

Hi @Gan_Jyi_Yng,

Hope this article help to resolve your concern:
http://appium.io/docs/en/writing-running-appium/android/android-shell/index.html

i am not sure what is the doc for?
i managed to move forward one step by launching app by adding this argument at desired capabilities
userProfile : 10
optionalIntentArguments : --user 10 -n “com.ninetest.hd3.work.cac/com.ninetest.hd3.activity.MailActivityEmail”

but still some error during execution
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot activate ‘com.ninetest.hd3.work.cac’. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\tester\.katalon\tools\android_sdk\platform-tools\adb.exe -P 5037 -s 2529b29c9b0c7ece shell monkey -p com.ninetest.hd3.work.cac -c android.intent.category.LAUNCHER 1’ exited with code 252’; Stderr: ‘args: [-p, com.ninetest.hd3.work.cac, -c, android.intent.category.LAUNCHER, 1]
arg: “-p”
arg: “com.ninetest.hd3.work.cac”
arg: “-c”
arg: “android.intent.category.LAUNCHER”
arg: “1”
data=“com.ninetest.hd3.work.cac”
data=“android.intent.category.LAUNCHER”’; Code: ‘252’ (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘LAPTOP-7932I49J’, ip: ‘192.168.48.1’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Capabilities {appActivity: com.ninetest.hd3.activit…, appPackage: com.ninetest.hd3.work.cac, appWaitActivity: com.ninetest.hd3.activit…, appWaitDuration: 60000, autoGrantPermissions: true, automationName: uiautomator2, databaseEnabled: false, desired: {appActivity: com.ninetest.hd3.activit…, appPackage: com.ninetest.hd3.work.cac, appWaitActivity: com.ninetest.hd3.activit…, appWaitDuration: 60000, autoGrantPermissions: true, automationName: uiautomator2, deviceId: , deviceName: samsung SM-N960F (Android 10), newCommandTimeout: 1800, noReset: true, optionalIntentArguments: --user 10 -n "com.ninefolde…, platform: ANDROID, platformName: Android, platformVersion: 10, systemPort: 8277, udid: 2529b29c9b0c7ece, userProfile: 10}, deviceApiLevel: 29, deviceId: , deviceManufacturer: samsung, deviceModel: SM-N960F, deviceName: 2529b29c9b0c7ece, deviceScreenDensity: 560, deviceScreenSize: 1440x2960, deviceUDID: 2529b29c9b0c7ece, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, noReset: true, optionalIntentArguments: --user 10 -n "com.ninefolde…, pixelRatio: 3.5, platform: ANDROID, platformName: Android, platformVersion: 10, statBarHeight: 84, systemPort: 8277, takesScreenshot: true, udid: 2529b29c9b0c7ece, userProfile: 10, viewportRect: {height: 2708, left: 0, top: 84, width: 1440}, warnings: {}, webStorageEnabled: false}
Session ID: f5673614-38c4-4c75-ba24-5dc9251354ac
at com.kms.katalon.composer.components.impl.dialogs.ProgressMonitorDialogWithThread.runAndWait(ProgressMonitorDialogWithThread.java:49)
at com.kms.katalon.composer.mobile.objectspy.components.MobileLocalAppComposite$12.run(MobileLocalAppComposite.java:474)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Cannot activate ‘com.ninetest.hd3.work.cac’. Original error: Error executing adbExec. Original error: ‘Command ‘C:\Users\tester\.katalon\tools\android_sdk\platform-tools\adb.exe -P 5037 -s 2529b29c9b0c7ece shell monkey -p com.ninetest.hd3.work.cac -c android.intent.category.LAUNCHER 1’ exited with code 252’; Stderr: ‘args: [-p, com.ninetest.hd3.work.cac, -c, android.intent.category.LAUNCHER, 1]
arg: “-p”
arg: “com.ninetest.hd3.work.cac”
arg: “-c”
arg: “android.intent.category.LAUNCHER”
arg: “1”
data=“com.ninetest.hd3.work.cac”
data=“android.intent.category.LAUNCHER”’; Code: ‘252’ (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘LAPTOP-7932I49J’, ip: ‘192.168.48.1’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.core.appium.driver.SwipeableAndroidDriver
Capabilities {appActivity: com.ninetest.hd3.activit…, appPackage: com.ninetest.hd3.work.cac, appWaitActivity: com.ninetest.hd3.activit…, appWaitDuration: 60000, autoGrantPermissions: true, automationName: uiautomator2, databaseEnabled: false, desired: {appActivity: com.ninetest.hd3.activit…, appPackage: com.ninetest.hd3.work.cac, appWaitActivity: com.ninetest.hd3.activit…, appWaitDuration: 60000, autoGrantPermissions: true, automationName: uiautomator2, deviceId: , deviceName: samsung SM-N960F (Android 10), newCommandTimeout: 1800, noReset: true, optionalIntentArguments: --user 10 -n "com.ninefolde…, platform: ANDROID, platformName: Android, platformVersion: 10, systemPort: 8277, udid: 2529b29c9b0c7ece, userProfile: 10}, deviceApiLevel: 29, deviceId: , deviceManufacturer: samsung, deviceModel: SM-N960F, deviceName: 2529b29c9b0c7ece, deviceScreenDensity: 560, deviceScreenSize: 1440x2960, deviceUDID: 2529b29c9b0c7ece, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, newCommandTimeout: 1800, noReset: true, optionalIntentArguments: --user 10 -n "com.ninefolde…, pixelRatio: 3.5, platform: ANDROID, platformName: Android, platformVersion: 10, statBarHeight: 84, systemPort: 8277, takesScreenshot: true, udid: 2529b29c9b0c7ece, userProfile: 10, viewportRect: {height: 2708, left: 0, top: 84, width: 1440}, warnings: {}, webStorageEnabled: false}
Session ID: f5673614-38c4-4c75-ba24-5dc9251354ac
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at com.kms.katalon.core.appium.driver.SwipeableAndroidDriver.execute(SwipeableAndroidDriver.java:1)
at io.appium.java_client.CommandExecutionHelper.execute(CommandExecutionHelper.java:27)
at io.appium.java_client.InteractsWithApps.activateApp(InteractsWithApps.java:165)
at io.appium.java_client.InteractsWithApps.activateApp(InteractsWithApps.java:149)
at com.kms.katalon.composer.mobile.objectspy.dialog.MobileInspectorController.startExistingApp(MobileInspectorController.java:143)
at com.kms.katalon.composer.mobile.objectspy.components.MobileLocalAppComposite$12$1.call(MobileLocalAppComposite.java:482)
at com.kms.katalon.composer.components.impl.dialogs.ProgressMonitorDialogWithThread.startThreadAndWait(ProgressMonitorDialogWithThread.java:36)
at com.kms.katalon.composer.components.impl.dialogs.ProgressMonitorDialogWithThread.runAndWait(ProgressMonitorDialogWithThread.java:48)
… 2 more

@duyluong the app launch now but i want to let katalon continue wait till i manually navigate to the screen of
com.ninetest.hd3.activity.MailActivityEmail

how can i do it?
so i manually tap first screen - then once reach second screen “com.ninetest.hd3.activity.MailActivityEmail” then katalon script continue run.

i have tried adding WebUI.delay(10)
but it does not work. execution stopped immediately after i manually tap on first screen to navigate to second screen.

@Gan_Jyi_Yng,

Please share the console log

@duyluong new 8.txt (28.6 KB)

just now the log is appium 1.15.1
i updated to Appium v1.19.1 still same error when execute test case.

@duyluong
any idea whats wrong?
what is the command fired by katalon “monkey shell”?

C:\Users\tester\.katalon\tools\android_sdk\platform-tools\adb.exe -P 5037 -s 2529b29c9b0c7ece shell monkey -p com.ninetest.hd3.work.cac -c android.intent.category.LAUNCHER 1
bash arg: -p
bash arg: com.ninetest.hd3.work.cac
bash arg: -c
bash arg: android.intent.category.LAUNCHER
bash arg: 1
args: [-p, com.ninetest.hd3.work.cac, -c, android.intent.category.LAUNCHER, 1]
arg: “-p”
arg: “com.ninetest.hd3.work.cac”
arg: “-c”
arg: “android.intent.category.LAUNCHER”
arg: “1”
data=“com.ninetest.hd3.work.cac”
data=“android.intent.category.LAUNCHER”
**** No activities found to run, monkey aborted.**

@duyluong or katalon team,

any update on this issue?

i have run the test successfully in robot framework.
let me know if the issues i saw in katalon is bug or?

or how can i use katalon like robot framework? e.g. i input all desired capabilities in the script and let appium interact with it directly.

Hi @Gan_Jyi_Yng,

Can you share your script, the desired capabilities settings and the full console log?

appWaitActivity String *
appWaitDuration String 60000
appPackage String com.test.abc.work.cac
appActivity String com.test.abc.activity.MailActivityEmail
noReset Boolean true
userProfile String 10
appWaitForLaunch Boolean false

log as per what i have attached earlier, here i attached latest.
attached lognew 18.txt (27.7 KB)

Hi @Gan_Jyi_Yng,

Your test failed because com.test.abc.activity.MailActivityEmail is not the main screen so don’t put it the appActivity:

appActivity String com.test.abc.activity.MailActivityEmail

Can you explain a little bit about your app or providing a recorded video on your device? Is com.test.abc.activity.MailActivityEmail the second screen after you touching the first screen right?

this settings works in robotframework.
so i dont think it is due to app activity.
i have splash screen which i tried and not working as well.
i cannot screen record and share with you the app video.

did u see my question above, somehow katalon uses monkey shell?
i believe this is the cause, as monkey shell supported lesser arguments…my app is enterprise app which installed in – user 10, work profile.

katalon mobile has no issue on the similiar app but installed at personal profile.

robotframework capabilities

&{ANDROID-CAPS-WORK} platformName=Android appPackage=com.test.abc.work.cac appActivity=com.test.abc.activity.MailActivityEmail automationName=UiAutomator2 userProfile=10 optionalIntentArguments=–user 10 -n com.test.abc.work.cac/com.test.abc.activity.MailActivityEmail

Hi @Gan_Jyi_Yng,

did u see my question above, somehow katalon uses monkey shell?
i believe this is the cause, as monkey shell supported lesser arguments…my app is enterprise app which installed in – user 10, work profile.

Our startExistingApplication that combines 2 appium commands:

  • startAppiumSession
  • activateApp

The Appium activateApp method uses “monkey shell” to activate your app. Please take a a look at their source code: https://github.com/appium/appium-android-driver/blob/9d120ba76df18ada8c5793af3d42f9b1aa4937cb/lib/commands/app-management.js#L59

To prevent using monkey shell, I think you should try this method instead of using startExistingApplication keyword.

import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory

MobileDriverFactory.startMobileDriver("your app ID")

some progress after changed to use mobiledriver, at main page, katalon is waiting for something.

e[35m[UiAutomator2]e[39m Starting 'com.test.abc.work.cac/com.test.abc.activity.MailActivityEmail and waiting for ‘com.test.abc.work.cac/*’

i guess i need some more lines needed? could you advise?

i removed appWaitActivity record in prj settings and works now.
thanks!
i will find a time to continue develop scripts in katalon… (i have done too much in RobotFramework :frowning:)

but katalon mobile object spy unable to run without the appWaitActivity
any idea how to fix this? or i can use other tool like uiautomatorviewer to capture objects and saved to katalon object repo?