TestProject Forum

How to Get OTP in IOS Device

Hi, im new in IOS device… is there any way to test OTP in IOS device? any clue how to do it like maybe a document?

Hi @fajar.ramadhan.r.s

What kind of OTP are you testing?
We have an addon for testing OTP for Google Authenticator,

Here is an useful article on how to use this addon:

Please let us know if you need any further assistance with this.

hi @artem.kuznetsov thank you for your tip, but is there any way to get an OTP in the message app

Hi @fajar.ramadhan.r.s

You mean SMS OTP?
We have an addon for getting OTP from SMS in Android devices,
using this addon:

hi @artem.kuznetsov
yes so we use SMS OTP, is there any way to catch SMS OTP?

Hi @fajar.ramadhan.r.s,

Can you share a screenshot of how does the SMS message of the OTP looks like?

Currently we don’t have an addon to get the OTP directly on IOS phones,
But you can record the steps that get the OTP from your messaging app.
The flow is like this: do action A which generates the OTP → open your messaging app → get the OTP and save it inside a parameter → return to the app which you need to type in the OTP.

To open your messaging app on IOS, we will use this addon for that:

The bundleID of the messaging app on IOS is: com.apple.MobileSMS

Now we will click on the first message in the app like this
image :

Inside the message we want to get the text of the OTP, the implementation of this step depends on the structure of your OTP message.
For example if the OTP message looks like this:

We would like to get the numbers that are around the hyphen(’-’),
we can do it by using “Extract String using RegEx” addon, like this:

After getting and storing the OTP inside a parameter,
we will launch back the app which issued the OTP,
using the same addon that we launched the messaging app.
You will need to have the bundleID of the original app in order to launch it.

After we get back to the original app, we want to type the OTP we saved, inside the desired field,
we can achieve this by using the Type text action, like this:

You can also group these steps into one subtest, and it will be much more cleaner and reusable,

Let me know if that was useful.

thank you! @artem.kuznetsov, i will try to do the steps.