TestProject Forum
Powered by leading experts in the test automation community

Problam with OTP Addon

Im using the OTP Addon for Android.
Well, I succeed to get the OTP by regex.
But my problem is that when the action start trying get the otp, it goes to black screen with title “TestProject” and back to the application few times, then the app reopen to home screen.
So I did get my OTP, but it’s no relevant anymore because I need to start all the flow again and get new OTP.
Someone have any solution for me?

Hello @Dor.yosef.shriki.

The OTP addons works by opening another application that reads the OTP and passes it into the output, and then puts you back in where you left off, however it seems the application you’re using goes back to the start of the flow due to this.

Consider opening another application before reading the OTP and afterwards going back to where you where in the original application, or using the OTP as an input parameter that has been known in advance before starting your test instead of reading it.

It happens 4 times.
After “Get OTP” action start, other application is opening and then return to my original application in the correct page (where i suppose to enter the OTP) 4 times. in the last time my application is reopen.

Anyway, your solution is working for me now.
Before reading the otp I’m running the action “start activity” to another app (calculator in my case), then run the otp and then return to my application by recording click on app switch button(key event 187 in android), then choose the application.
Any elegant solution for switching apps?