All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.v118.fedcm.FedCm Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.16.1
Show newest version
package org.openqa.selenium.devtools.v118.fedcm;

import org.openqa.selenium.Beta;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.ConverterFunctions;
import com.google.common.collect.ImmutableMap;
import org.openqa.selenium.json.JsonInput;

/**
 * This domain allows interacting with the FedCM dialog.
 */
@Beta()
public class FedCm {

    public static Command enable(java.util.Optional disableRejectionDelay) {
        ImmutableMap.Builder params = ImmutableMap.builder();
        disableRejectionDelay.ifPresent(p -> params.put("disableRejectionDelay", p));
        return new Command<>("FedCm.enable", params.build());
    }

    public static Command disable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("FedCm.disable", params.build());
    }

    public static Command selectAccount(java.lang.String dialogId, java.lang.Integer accountIndex) {
        java.util.Objects.requireNonNull(dialogId, "dialogId is required");
        java.util.Objects.requireNonNull(accountIndex, "accountIndex is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("dialogId", dialogId);
        params.put("accountIndex", accountIndex);
        return new Command<>("FedCm.selectAccount", params.build());
    }

    /**
     * Only valid if the dialog type is ConfirmIdpSignin. Acts as if the user had
     * clicked the continue button.
     */
    public static Command confirmIdpSignin(java.lang.String dialogId) {
        java.util.Objects.requireNonNull(dialogId, "dialogId is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("dialogId", dialogId);
        return new Command<>("FedCm.confirmIdpSignin", params.build());
    }

    public static Command dismissDialog(java.lang.String dialogId, java.util.Optional triggerCooldown) {
        java.util.Objects.requireNonNull(dialogId, "dialogId is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("dialogId", dialogId);
        triggerCooldown.ifPresent(p -> params.put("triggerCooldown", p));
        return new Command<>("FedCm.dismissDialog", params.build());
    }

    /**
     * Resets the cooldown time, if any, to allow the next FedCM call to show
     * a dialog even if one was recently dismissed by the user.
     */
    public static Command resetCooldown() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("FedCm.resetCooldown", params.build());
    }

    public static Event dialogShown() {
        return new Event<>("FedCm.dialogShown", input -> input.read(org.openqa.selenium.devtools.v118.fedcm.model.DialogShown.class));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy