Login with Multi Factor Authentication
Webpage: https://seleniumbase.io/realworld/login
Technology: Web Application, MFA , TOTP
Download the .robot
example from here and the totp.py
file from here.
- mfa_login.robot
- totp.py
*** Settings ***
Library Browser
Library totp.py
Suite Setup New Browser browser=${BROWSER} headless=${HEADLESS}
Test Setup New Context
Test Teardown Close Context
Suite Teardown Close Browser
*** Variables ***
${BROWSER} chromium
${HEADLESS} False
*** Test Cases ***
Login with MFA
New Page https://seleniumbase.io/realworld/login
Fill Text id=username demo_user
Fill Text id=password secret_pass
${totp} Get Totp GAXG2MTEOR3DMMDG
Fill Text id=totpcode ${totp}
Click "Sign in"
Get Text h1 == Welcome!
import pyotp
def get_totp(secret):
totp = pyotp.TOTP(secret)
return totp.now()