How to set an app password and verify the email of the logged-in users into an application?

How to automate a test case where 2 — factor authentication is enabled?

  • Open your Google account
  • Click on Manage your Google Account and select security
  • Under “Signing in to Google,” select App Passwords
  • Sign in, to your account
  • Select app and device and click on Generate button as shown in the below image
  • The App Password appears in the yellow bar on your device as shown below:

Code to Verify the user is getting an email notification for the user logged in to the system

*** Settings ***
Library Collections
Library OperatingSystem
Library String
Library SeleniumLibrary

*** Variables ***
${driver} webdriver.gecko.driver
${path} C:\\Users\\ddev0\\Downloads\\driver\\chromedriver
${url}= “enter your site URL here”
${browser} chrome

#Gmail Login
USER_PASS = "wituloholeefukow" #App password
APP_USER_PASS = "Tester1@”

*** Keywords ***
Verify Email Notification For Logged In User
[Documentation] This keyword use to verify email of account verified
... Argument1: user of the registered user
... Argument2: email of the registered user
[Arguments] ${username} ${email}
Open Mailbox user=${USER_EMAIL} password=${USER_PASS}
${LATEST} = Wait For Email subject=Login (${email}) timeout=300
${HTML} = Get Email body ${LATEST}
Should Contain ${HTML} Hello ${username}
Should Contain ${HTML} Thank you for verifying your email address. Your account will be approved shortly and you will receive an email with information
Should Contain ${HTML} In the meantime, please make sure to sign up
Close Mailbox

Login With User #created keyword to login into my app
[Arguments] ${user} ${pswd}
Login Page Should Be Seen
input text ${EMAIL_INPUT_FIELD} ${user}
input text ${PASSWORD_INPUT_FIELD} ${pswd}
Click Button ${SUBMIT_BTN}

*** Test Cases ***

Verify user is getting notification when a registered user logged in into system
[Tags] test=1
Set Environment Variable ${driver} ${path}
Open Browser ${url} ${browser}
Verify Email Notification For Logged In User ${USERNAME} ${USER_EMAIL}
Close After Test ${USERNAME}
Close Browser



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Devstringx Technologies

Devstringx Technologies


Devstringx Technologies is highly recommended IT company for custom software development, mobile app development and automation testing services