Two-Factor Authentication Handling

Purpose

This component addresses the challenge of automating login to Qualtrics accounts that require multi-factor authentication (MFA) and browser trust verification. Since these security steps involve dynamic user interactions beyond simple form submission, this subtopic focuses on detecting and managing these prompts within the automated login flow, ensuring the process completes successfully without manual intervention.

Functionality

The key functionality centers around:

This behavior is embedded within the Selenium-driven login method, which orchestrates the entire login sequence including MFA handling:

while not self._at_qualtrics(driver):
    if self._check_for_trust_browser_page(driver):
        trust_browser_button = driver.find_element(By.ID, 'trust-browser-button')
        trust_browser_button.click()
        self.human_sleep()

This loop effectively waits through MFA verification and trust prompts, allowing the user to complete two-step authentication (e.g., via mobile device) while the automation monitors and handles browser prompts.

Relationship

Two-Factor Authentication Handling is a critical extension of the **Automated Qualtrics Login** main topic and specifically complements the **Selenium Login Automation** and **Human Interaction Simulation** subtopics by:

This subtopic introduces reactive automation strategies for security prompt detection and interaction, a nuance not covered by the basic Selenium login mechanics or typing simulation alone.


Diagram: Two-Factor Authentication Handling Flow

flowchart TD
    Start[Start Login: Submit Credentials] --> WaitAuth[Wait for Authentication]
    WaitAuth --> CheckQualtrics{At Qualtrics Dashboard?}
    CheckQualtrics -->|Yes| AuthDone[Login Successful]
    CheckQualtrics -->|No| CheckTrust[Trust Browser Prompt?]
    CheckTrust -->|Yes| ClickTrust[Click Trust Button]
    ClickTrust --> HumanSleep[Pause: Human-like Delay]
    HumanSleep --> WaitAuth
    CheckTrust -->|No| WaitAuth

This flowchart illustrates the continuous polling mechanism post-credential submission, detecting whether the login is complete or if additional prompts require interaction, ensuring a fully authenticated session before proceeding.