Implementation:SeleniumHQ Selenium FederatedCredentialManagementAccount
| Knowledge Sources | |
|---|---|
| Domains | WebDriver, Federated_Credentials |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
FederatedCredentialManagementAccount is a data class representing a single account entry displayed in a FedCM (Federated Credential Management) account list dialog, as defined by the W3C FedCM specification.
Description
FederatedCredentialManagementAccount models an identity provider account shown to the user during a federated sign-in flow. The class is constructed from a Map<String, String> dictionary (typically deserialized from the WebDriver protocol response) and exposes nullable getters for the following account properties:
- accountId -- unique identifier for the account
- email -- the account email address
- name -- the display name of the account
- givenName -- the given (first) name
- pictureUrl -- URL of the account's profile picture
- idpConfigUrl -- the identity provider's config URL (useful in multi-IDP scenarios)
- loginState -- one of
LOGIN_STATE_SIGNIN("SignIn") orLOGIN_STATE_SIGNUP("SignUp") - termsOfServiceUrl -- URL to the terms of service
- privacyPolicyUrl -- URL to the privacy policy
The class is annotated with @NullMarked and all fields are @Nullable, reflecting that not all fields are guaranteed to be present in every response.
Usage
Use FederatedCredentialManagementAccount to inspect accounts presented in a FedCM dialog during automated testing. Account objects are obtained through FederatedCredentialManagementDialog.getAccounts() and can be used to verify account details or determine which account to select.
Code Reference
Source Location
- Repository: SeleniumHQ_Selenium
- File: java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementAccount.java
Signature
@NullMarked
public class FederatedCredentialManagementAccount {
public static final String LOGIN_STATE_SIGNIN = "SignIn";
public static final String LOGIN_STATE_SIGNUP = "SignUp";
public FederatedCredentialManagementAccount(Map<String, String> dict)
public @Nullable String getAccountid()
public @Nullable String getEmail()
public @Nullable String getName()
public @Nullable String getGivenName()
public @Nullable String getPictureUrl()
public @Nullable String getIdpConfigUrl()
public @Nullable String getLoginState()
public @Nullable String getTermsOfServiceUrl()
public @Nullable String getPrivacyPolicyUrl()
}
Import
import org.openqa.selenium.federatedcredentialmanagement.FederatedCredentialManagementAccount;
I/O Contract
Constructor Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
dict |
Map<String, String> |
Yes | A dictionary of account properties from the WebDriver protocol response |
Dictionary Keys
| Key | Type | Nullable | Description |
|---|---|---|---|
accountId |
String |
Yes | Unique account identifier |
email |
String |
Yes | Account email address |
name |
String |
Yes | Display name |
givenName |
String |
Yes | Given (first) name |
pictureUrl |
String |
Yes | Profile picture URL |
idpConfigUrl |
String |
Yes | Identity provider config URL |
loginState |
String |
Yes | Login state: "SignIn" or "SignUp" |
termsOfServiceUrl |
String |
Yes | Terms of service URL |
privacyPolicyUrl |
String |
Yes | Privacy policy URL |
Constants
| Constant | Value | Description |
|---|---|---|
LOGIN_STATE_SIGNIN |
"SignIn" |
Indicates the user has previously signed in with this account |
LOGIN_STATE_SIGNUP |
"SignUp" |
Indicates this would be a new sign-up for the user |
Usage Examples
// Wait for a FedCM dialog to appear and inspect accounts
HasFederatedCredentialManagement fedCmDriver =
(HasFederatedCredentialManagement) driver;
FederatedCredentialManagementDialog dialog =
new WebDriverWait(driver, Duration.ofSeconds(5))
.until(d -> fedCmDriver.getFederatedCredentialManagementDialog());
// Get accounts from the dialog
List<FederatedCredentialManagementAccount> accounts = dialog.getAccounts();
// Inspect account properties
for (FederatedCredentialManagementAccount account : accounts) {
System.out.println("Account: " + account.getName());
System.out.println("Email: " + account.getEmail());
System.out.println("Login State: " + account.getLoginState());
System.out.println("IDP: " + account.getIdpConfigUrl());
}
// Find an account by email and select it
for (int i = 0; i < accounts.size(); i++) {
if ("user@example.com".equals(accounts.get(i).getEmail())) {
dialog.selectAccount(i);
break;
}
}
// Check login state
FederatedCredentialManagementAccount account = accounts.get(0);
if (FederatedCredentialManagementAccount.LOGIN_STATE_SIGNUP.equals(account.getLoginState())) {
// This is a new sign-up flow
}
Related Pages
- FederatedCredentialManagementDialog -- the dialog that presents these accounts
- HasFederatedCredentialManagement -- interface for drivers that support FedCM interaction
- Data Transfer Object -- account is a simple data holder constructed from a protocol response map
- Null Safety -- all fields are nullable with
@NullMarkedannotation