Web Automation 2FA Gmail

I am new to UiPath and would like to automate the following workflow:

  1. Login to a Website – Authenticate using a username/email and password.
  2. Retrieve OTP from Gmail – Extract the OTP from an email and enter it on the website.
  3. Navigate to the Reports Section – Scroll to a specific tab and input a dynamic date range (last week’s start and end dates).
  4. Download the Report – Automate the report download process.
  5. Save the Report to a Specific Folder – Move the downloaded file from C:/Users/a/Downloads/report.csv to C:/Documents/TEST/report.csv
  6. Schedule the Bot Execution – Deploy the bot to run daily at 7:00 AM, ensuring it operates even when the system is not logged in.

Could you please advise on the feasibility of this automation in UiPath and recommend the best practices or any necessary configurations to achieve this?

@np_data

Welcome to the community

the tasks are straight so not much on logic…will provide the activities that would help

ui activities, click, type into, use application/browser, get credentials - basically retrieves the credentials from orchestrator asset

Gmail activities - https://docs.uipath.com/activities/other/latest/productivity/gmail-application-card

Same ui activities as 1. along with that…for dates - How to get the 1st and last days of the Last week - #6 by Gokul001

same ui activities and then move file activity…also instead of moving while downloading in type into you can specify full location so that no need to move as well

this is to be done in orchestrator via triggers

cheers

2 Likes

Yes, this automation is feasible in UiPath, and you can achieve it using the following best practices and configurations:


Step-by-Step UiPath Workflow:

1. Login to the Website

  • Use the Open Browser activity to navigate to the website.
  • Use Type Into activities to enter the username/email and password.
  • Click the Login button using the Click activity.

2. Retrieve OTP from Gmail

  • Use the Get IMAP Mail Messages or Get Outlook Mail Messages activity to retrieve the email.
  • Apply a filter to extract the latest OTP email (check for subject/keywords like “Your OTP code”).
  • Use Regex or String Manipulation to extract the OTP from the email body.
  • Use Type Into to enter the OTP on the website.

3. Navigate to Reports Section

  • Use the Click activity to go to the Reports tab.
  • Use Type Into to enter the start and end dates dynamically:
    • Use Now.AddDays(-7).ToString("MM/dd/yyyy") for the start date.
    • Use Now.AddDays(-1).ToString("MM/dd/yyyy") for the end date.
  • Click the Generate Report button.

4. Download the Report

  • Use the Click activity to download the report.
  • If a pop-up appears, use Send Hotkey (Enter or Ctrl+S) to save the file.
  • Wait until the download completes using a Delay or a File Exists check.

5. Move the File to a Specific Folder

  • Use the Move File activity:
    • From: C:/Users/a/Downloads/report.csv
    • To: C:/Documents/TEST/report.csv

6. Schedule the Bot Execution

  • Use UiPath Orchestrator to schedule the bot at 7:00 AM daily:
    • Publish the process to Orchestrator.
    • Create a Trigger with a daily schedule at 7:00 AM.
  • To ensure it runs without a logged-in user, configure Unattended Robot settings in Orchestrator.

Best Practices:

:white_check_mark: Use Secure Credentials: Store passwords in UiPath Orchestrator Assets or Windows Credential Manager.
:white_check_mark: Exception Handling: Add Try-Catch blocks to handle login failures, OTP errors, or missing reports.
:white_check_mark: Dynamic Selectors: Ensure UI elements are stable by using wildcards (*) or anchor-based automation.
:white_check_mark: Logging & Alerts: Use Write Line or Log Message to track execution. Send an email if an error occurs.

Thanks, let me test this out and get back to you.

Thanks. I’ll check and let you know

1 Like