Skip to content

Commit 26173f6

Browse files
committed
Add clickDialogButton methods for FedCM
This builds on commit 7ad44ee The specification for clickdialogbutton is here: https://fedidcg.github.io/FedCM/#webdriver-clickdialogbutton The version that takes an index is specified here: w3c-fedid/FedCM#610 Bug #12088
1 parent 53ed43c commit 26173f6

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

java/src/org/openqa/selenium/federatedcredentialmanagement/FederatedCredentialManagementDialog.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public interface FederatedCredentialManagementDialog {
2929
String DIALOG_TYPE_ACCOUNT_LIST = "AccountChooser";
3030
String DIALOG_TYPE_AUTO_REAUTH = "AutoReauthn";
3131

32+
String BUTTON_CONFIRM_IDP_LOGIN_CONTINUE = "ConfirmIdpLoginContinue";
33+
// The following buttons need an account index.
34+
String BUTTON_TERMS_OF_SERVICE = "TermsOfService";
35+
String BUTTON_PRIVACY_POLICY = "PrivacyPolicy";
36+
3237
/** Closes the dialog as if the user had clicked X. */
3338
void cancelDialog();
3439

@@ -58,4 +63,19 @@ public interface FederatedCredentialManagementDialog {
5863
* <p>If this is an auto reauth dialog, returns the single account that is being signed in.
5964
*/
6065
List<FederatedCredentialManagementAccount> getAccounts();
66+
67+
/**
68+
* Clicks a button on the dialog.
69+
*
70+
* @param button The button to click.
71+
*/
72+
void clickButton(String button);
73+
74+
/**
75+
* Clicks a button on the dialog that requires an account index.
76+
*
77+
* @param button The button to click.
78+
* @param index The account index, if needed by the specified button.
79+
*/
80+
void clickButton(String button, int index);
6181
}

java/src/org/openqa/selenium/remote/FedCmDialogImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,15 @@ public List<FederatedCredentialManagementAccount> getAccounts() {
7070
}
7171
return accounts;
7272
}
73+
74+
@Override
75+
public void clickButton(String button) {
76+
executeMethod.execute(DriverCommand.CLICK_DIALOG, Map.of("dialogButton", button));
77+
}
78+
79+
@Override
80+
public void clickButton(String button, int index) {
81+
executeMethod.execute(DriverCommand.CLICK_DIALOG,
82+
Map.of("dialogButton", button, "index", index));
83+
}
7384
}

0 commit comments

Comments
 (0)