How to automate If Otp not entered into field then click on Resend OTP option

Hi Team,
How to automate if OTP not entered into fields/invalid OTP message is displayed then click on Resend OTP option

Hi Rakesh,

I think some context will be needed before anyone can help you.

Dave.

To your Question…

  1. I am from Selenium Library
  2. and OTP mean One Time Password which is send to user mobile number for authentication while login into any ecommerce site.

Hi Rakesh,

Ah ha, got it. This is not commonly referred to using that OTP acronym, so no one would have had a clue that was what you were trying to do.

The common term for that is “Two Factor Authentication” (TFA or 2FA).

There are many strategies for dealing with two factor authentication, and this is not really a robot framework specific thing, once you have selected a strategy you can ask specific questions here about how to implement strategy xyz in robot framework and myself or someone else can help you.

First you need to choose a strategy, this is not something you can do on your own, you’ll need to discuss the options with your test manager and development team first as there are test implications and potential costs associated with all of them.

I suggest you search for “Two Factor Authentication” and “test automation” and find out what other people do, but to give you a head start here are some common options:

  • simply disable Two Factor Authentication in the test environment
    • Pro: test automation is easy
    • Con: no test coverage of TFA
  • Configure a generic code that is always the same in the test environment
    • Pro: test automation is easy
    • Con: limited test coverage of TFA & potentially extra code for the developers
  • Send the TFA message to an interface / file / database / somewhere the test automation can get it (your application may already do this and it’s just a matter of the devs documenting it or pointing you to the documentation)
    • Pro: most prod like, best test coverage of TFA
    • Con: potentially extra code for the developers, may be tricky to implement in test automation

Good luck and I hope this helps,

Dave.

1 Like