Skip to content

Commit

Permalink
Add clickDialogButton methods for FedCM
Browse files Browse the repository at this point in the history
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 SeleniumHQ#12088
  • Loading branch information
cbiesinger committed Jun 3, 2024
1 parent 53ed43c commit 26173f6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -58,4 +63,19 @@ public interface FederatedCredentialManagementDialog {
* <p>If this is an auto reauth dialog, returns the single account that is being signed in.
*/
List<FederatedCredentialManagementAccount> 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);
}
11 changes: 11 additions & 0 deletions java/src/org/openqa/selenium/remote/FedCmDialogImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,15 @@ public List<FederatedCredentialManagementAccount> 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));
}
}

0 comments on commit 26173f6

Please sign in to comment.