diff --git a/common/src/web/fedcm/client_metadata.json b/common/src/web/fedcm/client_metadata.json
index ddde867a9f7bf4..bd59185c97cd6b 100644
--- a/common/src/web/fedcm/client_metadata.json
+++ b/common/src/web/fedcm/client_metadata.json
@@ -1,4 +1,4 @@
{
- "privacy_policy_url": "https://rp.example/privacy_policy.html",
- "terms_of_service_url": "https://rp.example/terms_of_service.html"
+ "privacy_policy_url": "privacy_policy.html",
+ "terms_of_service_url": "terms_of_service.html"
}
diff --git a/common/src/web/fedcm/privacy_policy.html b/common/src/web/fedcm/privacy_policy.html
new file mode 100644
index 00000000000000..1e1d4b57604dd8
--- /dev/null
+++ b/common/src/web/fedcm/privacy_policy.html
@@ -0,0 +1,4 @@
+
+
Privacy Policy
+
+This is the privacy policy.
diff --git a/java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java b/java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java
index 04de4e4758e5d9..d4fb9234e2cca3 100644
--- a/java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java
+++ b/java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java
@@ -29,6 +29,11 @@ public interface FederatedCredentialManagementDialog {
String DIALOG_TYPE_ACCOUNT_LIST = "AccountChooser";
String DIALOG_TYPE_AUTO_REAUTH = "AutoReauthn";
+ String BUTTON_CONFIRM_IDP_LOGIN_CONTINUE = "ConfirmIdpLoginContinue";
+ // The following buttons need an account index.
+ String BUTTON_TERMS_OF_SERVICE = "TermsOfService";
+ String BUTTON_PRIVACY_POLICY = "PrivacyPolicy";
+
/** Closes the dialog as if the user had clicked X. */
void cancelDialog();
@@ -58,4 +63,19 @@ public interface FederatedCredentialManagementDialog {
* If this is an auto reauth dialog, returns the single account that is being signed in.
*/
List getAccounts();
+
+ /**
+ * Clicks a button on the dialog.
+ *
+ * @param button The button to click.
+ */
+ void clickButton(String button);
+
+ /**
+ * Clicks a button on the dialog that requires an account index.
+ *
+ * @param button The button to click.
+ * @param index The account index, if needed by the specified button.
+ */
+ void clickButton(String button, int index);
}
diff --git a/java/src/org/openqa/selenium/remote/FedCmDialogImpl.java b/java/src/org/openqa/selenium/remote/FedCmDialogImpl.java
index d61b1a1acccbbe..ebb2c14698bb42 100644
--- a/java/src/org/openqa/selenium/remote/FedCmDialogImpl.java
+++ b/java/src/org/openqa/selenium/remote/FedCmDialogImpl.java
@@ -70,4 +70,15 @@ public List getAccounts() {
}
return accounts;
}
+
+ @Override
+ public void clickButton(String button) {
+ executeMethod.execute(DriverCommand.CLICK_DIALOG, Map.of("dialogButton", button));
+ }
+
+ @Override
+ public void clickButton(String button, int index) {
+ executeMethod.execute(DriverCommand.CLICK_DIALOG,
+ Map.of("dialogButton", button, "index", index));
+ }
}
diff --git a/java/test/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementTest.java b/java/test/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementTest.java
index 8bf947f4ca5843..dd330b2d6b5c5f 100644
--- a/java/test/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementTest.java
+++ b/java/test/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementTest.java
@@ -138,4 +138,35 @@ void testSelectAccount() {
response = jsAwareDriver.executeScript("return await promise");
assertThat(response).asInstanceOf(MAP).containsEntry("token", "a token");
}
+
+ @Test
+ @NotYetImplemented(
+ value = CHROME,
+ reason = "https://github.com/SeleniumHQ/selenium/pull/12096#issuecomment-2017760822")
+ void testClickDialogButton() {
+ fedcmDriver.setDelayEnabled(false);
+ assertNull(fedcmDriver.getFederatedCredentialManagementDialog());
+
+ Object response = triggerFedCm();
+
+ waitForDialog();
+
+ FederatedCredentialManagementDialog dialog =
+ fedcmDriver.getFederatedCredentialManagementDialog();
+
+ assertEquals("Sign in to localhost with localhost", dialog.getTitle());
+ assertEquals("AccountChooser", dialog.getDialogType());
+
+ dialog.clickButton(dialog.BUTTON_PRIVACY_POLICY, 0);
+ int windowCount = localDriver.getWindowHandles().size();
+ WebDriverWait wait = new WebDriverWait(localDriver, Duration.ofSeconds(5));
+ wait.until(
+ driver ->
+ driver.getWindowHandles().size() > windowCount);
+
+ dialog.selectAccount(0);
+
+ response = jsAwareDriver.executeScript("return await promise");
+ assertThat(response).asInstanceOf(MAP).containsEntry("token", "a token");
+ }
}