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

org.openqa.selenium.devtools.v119.cast.Cast 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.0
Show newest version
package org.openqa.selenium.devtools.v119.cast;

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;

/**
 * A domain for interacting with Cast, Presentation API, and Remote Playback API
 * functionalities.
 */
@Beta()
public class Cast {

    /**
     * Starts observing for sinks that can be used for tab mirroring, and if set,
     * sinks compatible with |presentationUrl| as well. When sinks are found, a
     * |sinksUpdated| event is fired.
     * Also starts observing for issue messages. When an issue is added or removed,
     * an |issueUpdated| event is fired.
     */
    public static Command enable(java.util.Optional presentationUrl) {
        LinkedHashMap params = new LinkedHashMap<>();
        presentationUrl.ifPresent(p -> params.put("presentationUrl", p));
        return new Command<>("Cast.enable", Map.copyOf(params));
    }

    /**
     * Stops observing for sinks and issues.
     */
    public static Command disable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("Cast.disable", Map.copyOf(params));
    }

    /**
     * Sets a sink to be used when the web page requests the browser to choose a
     * sink via Presentation API, Remote Playback API, or Cast SDK.
     */
    public static Command setSinkToUse(java.lang.String sinkName) {
        java.util.Objects.requireNonNull(sinkName, "sinkName is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("sinkName", sinkName);
        return new Command<>("Cast.setSinkToUse", Map.copyOf(params));
    }

    /**
     * Starts mirroring the desktop to the sink.
     */
    public static Command startDesktopMirroring(java.lang.String sinkName) {
        java.util.Objects.requireNonNull(sinkName, "sinkName is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("sinkName", sinkName);
        return new Command<>("Cast.startDesktopMirroring", Map.copyOf(params));
    }

    /**
     * Starts mirroring the tab to the sink.
     */
    public static Command startTabMirroring(java.lang.String sinkName) {
        java.util.Objects.requireNonNull(sinkName, "sinkName is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("sinkName", sinkName);
        return new Command<>("Cast.startTabMirroring", Map.copyOf(params));
    }

    /**
     * Stops the active Cast session on the sink.
     */
    public static Command stopCasting(java.lang.String sinkName) {
        java.util.Objects.requireNonNull(sinkName, "sinkName is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("sinkName", sinkName);
        return new Command<>("Cast.stopCasting", Map.copyOf(params));
    }

    public static Event> sinksUpdated() {
        return new Event<>("Cast.sinksUpdated", ConverterFunctions.map("sinks", java.util.List.class));
    }

    public static Event issueUpdated() {
        return new Event<>("Cast.issueUpdated", ConverterFunctions.map("issueMessage", java.lang.String.class));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy