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

org.openqa.selenium.devtools.v85.security.Security 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.26.0
Show newest version
package org.openqa.selenium.devtools.v85.security;

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;

/**
 * Security
 */
public class Security {

    /**
     * Disables tracking security state changes.
     */
    public static Command disable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("Security.disable", params.build());
    }

    /**
     * Enables tracking security state changes.
     */
    public static Command enable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("Security.enable", params.build());
    }

    /**
     * Enable/disable whether all certificate errors should be ignored.
     */
    @Beta()
    public static Command setIgnoreCertificateErrors(java.lang.Boolean ignore) {
        java.util.Objects.requireNonNull(ignore, "ignore is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("ignore", ignore);
        return new Command<>("Security.setIgnoreCertificateErrors", params.build());
    }

    /**
     * Handles a certificate error that fired a certificateError event.
     */
    @Deprecated()
    public static Command handleCertificateError(java.lang.Integer eventId, org.openqa.selenium.devtools.v85.security.model.CertificateErrorAction action) {
        java.util.Objects.requireNonNull(eventId, "eventId is required");
        java.util.Objects.requireNonNull(action, "action is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("eventId", eventId);
        params.put("action", action);
        return new Command<>("Security.handleCertificateError", params.build());
    }

    /**
     * Enable/disable overriding certificate errors. If enabled, all certificate error events need to
     * be handled by the DevTools client and should be answered with `handleCertificateError` commands.
     */
    @Deprecated()
    public static Command setOverrideCertificateErrors(java.lang.Boolean override) {
        java.util.Objects.requireNonNull(override, "override is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("override", override);
        return new Command<>("Security.setOverrideCertificateErrors", params.build());
    }

    public static Event certificateError() {
        return new Event<>("Security.certificateError", input -> input.read(org.openqa.selenium.devtools.v85.security.model.CertificateError.class));
    }

    public static Event visibleSecurityStateChanged() {
        return new Event<>("Security.visibleSecurityStateChanged", ConverterFunctions.map("visibleSecurityState", org.openqa.selenium.devtools.v85.security.model.VisibleSecurityState.class));
    }

    public static Event securityStateChanged() {
        return new Event<>("Security.securityStateChanged", input -> input.read(org.openqa.selenium.devtools.v85.security.model.SecurityStateChanged.class));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy