Automating MFA in katalon studio that recieves otp in mobile

Hi Team,

Can any one help how to automate Multi-factor auth (MFA) based application with Katalon Studio, and I need to pass auth code which was sent to my mobile. Please advise.



Thank you for sharing your demand. Please refer to this: Automating Application-based MFA with Katalon Studio - #6 by Rocky_N

Thanks Elly for your response.
The one you have shared is related to getting code from gmail inbox, can you please share how to pass auth code which was sent to my mobile/ or how to get otp from pingid app in my mobile , so that I can enter that code to login the application.



Thank you for clarifying it. I might suggest the following steps:

  1. Set up Mobile Testing Environment:
  • Ensure you have the required mobile devices (physical or emulators) set up and connected to Katalon Studio.
  • Install the PingID app on the mobile device.
  1. Create a Mobile Test Case:
  • Create a new test case for mobile testing in Katalon Studio.
  • Use the “Mobile.startApplication” keyword to start the PingID app on the mobile device.
  • Use the “Mobile.verifyElementPresent” or similar keywords to check if the OTP input field or the OTP itself is visible on the screen.
  1. Get OTP from Mobile Device:
  • Use the “Mobile.getText” keyword to get the text value from the OTP input field.
  • If the OTP is sent as a notification, use the appropriate mobile keywords to access notifications and extract the OTP.
  1. Pass the OTP to Your Application:
  • Use the “Mobile.setText” keyword to enter the OTP into the relevant input field of your application.

This will be the example:

import as Mobile

// Start the PingID app
Mobile.startApplication('com.pingidentity.pingid', false)

// Wait for the OTP input field to appear on the screen (adjust the xpath or id as per your app)
Mobile.verifyElementPresent(findTestObject('Object Repository/PingID App/OTP_Input_Field'), 30)

// Get the OTP from the input field
String otp = Mobile.getText(findTestObject('Object Repository/PingID App/OTP_Input_Field'))

// Print the OTP (you can pass it to your application or use it as needed)
println("OTP: " + otp)

Thanks for the above.
For mobile device setup(emulator), I have installed node.js and android studio, and did the pingId installed in mobile. Started the emulator in android studio. Then If I run the test it is failing at starting step itself which is Mobile.startApplication(‘com.pingidentity.pingid’, false).

Note: Tried running the test using android simulator and also in chrome , both are not working.Failing at same step

When I run the test using android simulator, errror which I’m getting:
ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to start app at: ‘com.pingidentity.pingid’ (Root cause: com.kms.katalon.core.appium.exception.AppiumStartException: Fail to start Appium server in 30 seconds

When I run test using chrom,
ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to start app at: ‘com.pingidentity.pingid’ (Root cause: java.lang.IllegalArgumentException: The mobile device is missing. Please select the mobile device to be executed and try again.

Please help how to get the otp from pingID, the first step.



This relates to Appium you are using. Please check:

  1. Verify Appium Installation: Running the Appium server separately and making sure it starts successfully.
  2. Check Appium Configuration: Window > Katalon Studio Preferences > Katalon > Mobile > Appium and make sure the correct Appium executable path is specified.
  3. Check Mobile Settings: Ensure that your Mobile settings in Katalon Studio are correctly configured. Go to Project Settings > Desired Capabilities and make sure you have specified the correct appPackage and appActivity for the “com.pingidentity.pingid” app.
  4. Verify Device Connection: Make sure your mobile device is connected and recognized by your computer. You can verify this by running adb devices command in the command prompt/terminal and checking if your device is listed.
  5. Check App Path: Ensure that the app file (APK or IPA) for “com.pingidentity.pingid” is present and accessible. Verify that the app path specified in Katalon Studio is correct.
  6. Appium Version: Check the compatibility of the Appium version you are using with Katalon Studio. Ensure that you are using a compatible version of Appium.

Try to restart KS if needed. Hope this can help!