Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.hubspot.chrome.devtools.client.core.headlessexperimental;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hubspot.chrome.devtools.base.ChromeRequest;
import com.hubspot.chrome.devtools.base.ChromeSessionCore;
import com.hubspot.chrome.devtools.client.core.runtime.Timestamp;
import java.util.concurrent.CompletableFuture;
/**
* This domain provides experimental commands only supported in headless mode.
*/
public final class HeadlessExperimental {
ChromeSessionCore chromeSession;
ObjectMapper objectMapper;
public HeadlessExperimental(ChromeSessionCore chromeSession, ObjectMapper objectMapper) {
this.chromeSession = chromeSession;
this.objectMapper = objectMapper;
}
/**
* Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
* screenshot from the resulting frame. Requires that the target was created with enabled
* BeginFrameControl.
*
* @param frameTime [Optional] Timestamp of this BeginFrame (milliseconds since epoch). If not set, the current time will
* be used.
* @param deadline [Optional] Deadline of this BeginFrame (milliseconds since epoch). If not set, the deadline will be
* calculated from the frameTime and interval.
* @param interval [Optional] The interval between BeginFrames that is reported to the compositor, in milliseconds.
* Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
* @param noDisplayUpdates [Optional] Whether updates should not be committed and drawn onto the display. False by default. If
* true, only side effects of the BeginFrame will be run, such as layout and animations, but
* any visual updates may not be visible on the display or in screenshots.
* @param screenshot [Optional] If set, a screenshot of the frame will be captured and returned in the response. Otherwise,
* no screenshot will be captured.
*/
public BeginFrameResult beginFrame(Timestamp frameTime, Timestamp deadline, Number interval,
Boolean noDisplayUpdates, ScreenshotParams screenshot) {
ChromeRequest chromeRequest = new ChromeRequest("HeadlessExperimental.beginFrame");
chromeRequest
.putParams("frameTime", frameTime)
.putParams("deadline", deadline)
.putParams("interval", interval)
.putParams("noDisplayUpdates", noDisplayUpdates)
.putParams("screenshot", screenshot);
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
* screenshot from the resulting frame. Requires that the target was created with enabled
* BeginFrameControl.
*
* @param frameTime [Optional] Timestamp of this BeginFrame (milliseconds since epoch). If not set, the current time will
* be used.
* @param deadline [Optional] Deadline of this BeginFrame (milliseconds since epoch). If not set, the deadline will be
* calculated from the frameTime and interval.
* @param interval [Optional] The interval between BeginFrames that is reported to the compositor, in milliseconds.
* Defaults to a 60 frames/second interval, i.e. about 16.666 milliseconds.
* @param noDisplayUpdates [Optional] Whether updates should not be committed and drawn onto the display. False by default. If
* true, only side effects of the BeginFrame will be run, such as layout and animations, but
* any visual updates may not be visible on the display or in screenshots.
* @param screenshot [Optional] If set, a screenshot of the frame will be captured and returned in the response. Otherwise,
* no screenshot will be captured.
*/
public CompletableFuture beginFrameAsync(Timestamp frameTime,
Timestamp deadline, Number interval, Boolean noDisplayUpdates, ScreenshotParams screenshot) {
ChromeRequest chromeRequest = new ChromeRequest("HeadlessExperimental.beginFrame");
chromeRequest
.putParams("frameTime", frameTime)
.putParams("deadline", deadline)
.putParams("interval", interval)
.putParams("noDisplayUpdates", noDisplayUpdates)
.putParams("screenshot", screenshot);
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
/**
* Disables headless events for the target.
*/
public void disable() {
ChromeRequest chromeRequest = new ChromeRequest("HeadlessExperimental.disable");
chromeSession.send(chromeRequest);
}
/**
* Disables headless events for the target.
*/
public void disableAsync() {
ChromeRequest chromeRequest = new ChromeRequest("HeadlessExperimental.disable");
chromeSession.sendAsync(chromeRequest);
}
/**
* Enables headless events for the target.
*/
public void enable() {
ChromeRequest chromeRequest = new ChromeRequest("HeadlessExperimental.enable");
chromeSession.send(chromeRequest);
}
/**
* Enables headless events for the target.
*/
public void enableAsync() {
ChromeRequest chromeRequest = new ChromeRequest("HeadlessExperimental.enable");
chromeSession.sendAsync(chromeRequest);
}
}