I have a scenario where I need to perform a login, but the problem is its based on OPT (I mean once I enter a phone number to that number I receive an OTP That OTP is the password)

  • Generally the problem is knowing what the OTP is. Which means from a testing standpoint you have to be able to fetch the password prior to use. Nov 21 '18 at 16:11

In software testing companies generally we are automating it by storing OTP in Database and then it is easy to automate by us while devops testing. You can use sql connection and get the 'OTP' code.

Please find below code snippet in support of above suggestion. I hope this approach will work well for you.

import pyodbc 
cnxn = pyodbc.connect("Driver={SQL Server Native Client 11.0};"

cursor = cnxn.cursor()
cursor.execute('SELECT otp FROM Table')

for row in cursor:
    print('row = %r' % (row,)) 


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.