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

org.openqa.selenium.devtools.v88.applicationcache.ApplicationCache Maven / Gradle / Ivy

package org.openqa.selenium.devtools.v88.applicationcache;

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;

@Beta()
public class ApplicationCache {

    /**
     * Enables application cache domain notifications.
     */
    public static Command enable() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("ApplicationCache.enable", params.build());
    }

    /**
     * Returns relevant application cache data for the document in given frame.
     */
    public static Command getApplicationCacheForFrame(org.openqa.selenium.devtools.v88.page.model.FrameId frameId) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("frameId", frameId);
        return new Command<>("ApplicationCache.getApplicationCacheForFrame", params.build(), ConverterFunctions.map("applicationCache", org.openqa.selenium.devtools.v88.applicationcache.model.ApplicationCache.class));
    }

    /**
     * Returns array of frame identifiers with manifest urls for each frame containing a document
     * associated with some application cache.
     */
    public static Command> getFramesWithManifests() {
        ImmutableMap.Builder params = ImmutableMap.builder();
        return new Command<>("ApplicationCache.getFramesWithManifests", params.build(), ConverterFunctions.map("frameIds", new com.google.common.reflect.TypeToken>() {
        }.getType()));
    }

    /**
     * Returns manifest URL for document in the given frame.
     */
    public static Command getManifestForFrame(org.openqa.selenium.devtools.v88.page.model.FrameId frameId) {
        java.util.Objects.requireNonNull(frameId, "frameId is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("frameId", frameId);
        return new Command<>("ApplicationCache.getManifestForFrame", params.build(), ConverterFunctions.map("manifestURL", java.lang.String.class));
    }

    public static Event applicationCacheStatusUpdated() {
        return new Event<>("ApplicationCache.applicationCacheStatusUpdated", input -> input.read(org.openqa.selenium.devtools.v88.applicationcache.model.ApplicationCacheStatusUpdated.class));
    }

    public static Event networkStateUpdated() {
        return new Event<>("ApplicationCache.networkStateUpdated", ConverterFunctions.map("isNowOnline", java.lang.Boolean.class));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy