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

org.openqa.selenium.devtools.v120.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.18.1
Show newest version
package org.openqa.selenium.devtools.v120.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 java.util.Map;
import java.util.LinkedHashMap;
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) {
        LinkedHashMap params = new LinkedHashMap<>();
        disableRejectionDelay.ifPresent(p -> params.put("disableRejectionDelay", p));
        return new Command<>("FedCm.enable", Map.copyOf(params));
    }

    public static Command disable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("FedCm.disable", Map.copyOf(params));
    }

    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");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("dialogId", dialogId);
        params.put("accountIndex", accountIndex);
        return new Command<>("FedCm.selectAccount", Map.copyOf(params));
    }

    /**
     * Only valid if the dialog type is ConfirmIdpLogin. Acts as if the user had
     * clicked the continue button.
     */
    public static Command confirmIdpLogin(java.lang.String dialogId) {
        java.util.Objects.requireNonNull(dialogId, "dialogId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("dialogId", dialogId);
        return new Command<>("FedCm.confirmIdpLogin", Map.copyOf(params));
    }

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

    /**
     * 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() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("FedCm.resetCooldown", Map.copyOf(params));
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy