Login to a website and answer security questions with Power Automate Desktop

Table of Contents

Logging in to a website by entering user and password is pretty common for many web apps, some websites add another layer of security by adding a set of semi-dynamic questions you need to answer to let you in.

This blog and video will show how to login to a website and answer security questions with Power Automate, on a website that requires answering dynamic security questions using Power Automate Desktop. The challenge lies in the website’s security questions, where out of three predefined questions, only two appear randomly each time a user logs in.

Is your business ready for automation?

Automate processes with Microsoft Power Platform.

The goal is to create a flexible automation flow that can identify which security questions are displayed and answer them correctly without manual intervention.

Use case description

User logs in with user and password:

If everything is Ok with the user and password, the webpage will display some security questions:

As part of the account set up, Xero.com asked us to define 3 questions we need to answer, but out of those 3, we will get 2 in a random order every time we login.

Step-by-step video walkthrough

Watch this video by Graciela, where she shows the whole process that goes from creating the workflow from scratch to answering the dynamic questions:

Solution description

Step 1. Set Up the Flow and Record Login

  • Begin by setting up a new flow in Power Automate Desktop.
  • Use the web recorder to capture the login process in Firefox.
  • Record basic login steps such as entering email and password.
  • Navigate to the security questions page.
  • Clean the flow manually when the recorder adds unnecessary steps or behaves unpredictably.

Step 2. Handle Dynamic Element Selectors

  • Inspect the webpage’s HTML to find more reliable and constant attributes, such as automation IDs—that remain constant.
  • Modify the selectors accordingly for both security question input boxes.

Step 3. Extract and Match Security Questions

  • Extract the question text dynamically from the webpage using UI element actions.
  • Introduce a JSON object that stores all possible questions and their predefined answers.
  • Retrieve the correct answer by matching the dynamic question text with the JSON keys.

Step 4. Add Wait Conditions and Handle Errors

  • Add wait conditions to ensure webpage elements are fully loaded before interacting with them.
  • Make sure all “wait” actions also have time-out time

Step 5. Test time!

Log out and test multiple times to confirm the bot correctly answers the security questions in any order and completes the login.

Are you ready to discover the joy of automation?

Whether you have a project in mind or just want to know how we can help, we’re happy to have a conversation

How our Power Automate Development services can help

Using our Power Automate Development services and Power Platform consulting services, we have helped many clients all over the world to automate tasks that range from tax form input to bank reconciliations, contact us, we’ll be more than happy to have a conversation and see how we can be of help for your team.

Author
Power Platform Consultant | Business Process Automation Expert
Microsoft Certified Power Platform Consultant and Solution Architect with 4+ years of experience leveraging Power Platform, Microsoft 365, and Azure to continuously discover automation opportunities and re-imagine processes.