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

org.openqa.selenium.devtools.v90.backgroundservice.BackgroundService 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.0.0-beta-4
Show newest version
package org.openqa.selenium.devtools.v90.backgroundservice;

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;

/**
 * Defines events for background web platform features.
 */
@Beta()
public class BackgroundService {

    /**
     * Enables event updates for the service.
     */
    public static Command startObserving(org.openqa.selenium.devtools.v90.backgroundservice.model.ServiceName service) {
        java.util.Objects.requireNonNull(service, "service is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("service", service);
        return new Command<>("BackgroundService.startObserving", params.build());
    }

    /**
     * Disables event updates for the service.
     */
    public static Command stopObserving(org.openqa.selenium.devtools.v90.backgroundservice.model.ServiceName service) {
        java.util.Objects.requireNonNull(service, "service is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("service", service);
        return new Command<>("BackgroundService.stopObserving", params.build());
    }

    /**
     * Set the recording state for the service.
     */
    public static Command setRecording(java.lang.Boolean shouldRecord, org.openqa.selenium.devtools.v90.backgroundservice.model.ServiceName service) {
        java.util.Objects.requireNonNull(shouldRecord, "shouldRecord is required");
        java.util.Objects.requireNonNull(service, "service is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("shouldRecord", shouldRecord);
        params.put("service", service);
        return new Command<>("BackgroundService.setRecording", params.build());
    }

    /**
     * Clears all stored data for the service.
     */
    public static Command clearEvents(org.openqa.selenium.devtools.v90.backgroundservice.model.ServiceName service) {
        java.util.Objects.requireNonNull(service, "service is required");
        ImmutableMap.Builder params = ImmutableMap.builder();
        params.put("service", service);
        return new Command<>("BackgroundService.clearEvents", params.build());
    }

    public static Event recordingStateChanged() {
        return new Event<>("BackgroundService.recordingStateChanged", input -> input.read(org.openqa.selenium.devtools.v90.backgroundservice.model.RecordingStateChanged.class));
    }

    public static Event backgroundServiceEventReceived() {
        return new Event<>("BackgroundService.backgroundServiceEventReceived", ConverterFunctions.map("backgroundServiceEvent", org.openqa.selenium.devtools.v90.backgroundservice.model.BackgroundServiceEvent.class));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy