Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:SeleniumHQ Selenium HasFederatedCredentialManagement

From Leeroopedia
Revision as of 11:51, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/SeleniumHQ_Selenium_HasFederatedCredentialManagement.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains WebDriver, Federated_Credentials
Last Updated 2026-02-12 00:00 GMT

Overview

HasFederatedCredentialManagement is a capability interface that WebDriver implementations can adopt to indicate support for interacting with FedCM (Federated Credential Management) dialogs, providing methods to control delay behavior, reset cooldowns, and access open dialogs.

Description

The HasFederatedCredentialManagement interface is annotated with @Beta, indicating it is part of the evolving FedCM WebDriver extension. It defines three methods:

  • setDelayEnabled(boolean enabled) -- controls whether FedCM's built-in promise rejection delay is active. FedCM intentionally delays promise resolution on failures for privacy reasons (to prevent timing attacks). Disabling this delay allows tests to run faster when privacy timing is not under test.
  • resetCooldown() -- resets the FedCM dialog cooldown timer. When the account chooser is dismissed, the user agent may enforce a cooldown before the dialog can be triggered again. This method resets that cooldown so tests can immediately trigger a new dialog.
  • getFederatedCredentialManagementDialog() -- returns the currently open FederatedCredentialManagementDialog, or null if no dialog is open. This method is designed to be used with WebDriverWait for polling.

Usage

Use HasFederatedCredentialManagement when writing automated tests that exercise federated sign-in flows using the FedCM API. Cast the WebDriver instance to this interface to access FedCM-specific functionality. This interface is typically implemented by browser drivers that support the FedCM WebDriver extension (e.g., Chrome, Edge).

Code Reference

Source Location

Signature

@Beta
@NullMarked
public interface HasFederatedCredentialManagement {

  void setDelayEnabled(boolean enabled);
  void resetCooldown();
  @Nullable FederatedCredentialManagementDialog getFederatedCredentialManagementDialog();
}

Import

import org.openqa.selenium.federatedcredentialmanagement.HasFederatedCredentialManagement;

I/O Contract

Methods

Method Return Type Description
setDelayEnabled(boolean enabled) void Enables or disables the FedCM promise rejection delay; disabling speeds up test execution for failure scenarios
resetCooldown() void Resets the dialog cooldown so the FedCM dialog can be triggered again immediately after dismissal
getFederatedCredentialManagementDialog() @Nullable FederatedCredentialManagementDialog Returns the currently open FedCM dialog, or null if none is open

setDelayEnabled Parameters

Parameter Type Required Description
enabled boolean Yes true to enable the standard privacy delay; false to disable it for faster test execution

Usage Examples

// Cast the driver to access FedCM capabilities
HasFederatedCredentialManagement fedCmDriver =
    (HasFederatedCredentialManagement) driver;

// Disable the promise rejection delay for faster tests
fedCmDriver.setDelayEnabled(false);

// Navigate to a page that triggers a FedCM flow
driver.get("https://example.com/fedcm-login");

// Wait for the FedCM dialog to appear
FederatedCredentialManagementDialog dialog =
    new WebDriverWait(driver, Duration.ofSeconds(10))
        .until(d -> ((HasFederatedCredentialManagement) d)
            .getFederatedCredentialManagementDialog());

// Interact with the dialog
List<FederatedCredentialManagementAccount> accounts = dialog.getAccounts();
dialog.selectAccount(0);

// Reset cooldown before triggering another dialog
fedCmDriver.resetCooldown();

// Trigger another FedCM flow
driver.get("https://example.com/another-fedcm-login");
FederatedCredentialManagementDialog secondDialog =
    new WebDriverWait(driver, Duration.ofSeconds(10))
        .until(d -> ((HasFederatedCredentialManagement) d)
            .getFederatedCredentialManagementDialog());
secondDialog.cancelDialog();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment