effect-playwright
    Preparing search index...

    Interface LocatorScreenshotOptions

    interface LocatorScreenshotOptions {
        animations?: "allow" | "disabled";
        caret?: "hide" | "initial";
        mask?: Locator[];
        maskColor?: string;
        omitBackground?: boolean;
        path?: string;
        quality?: number;
        scale?: "css" | "device";
        signal?: AbortSignal;
        style?: string;
        timeout?: number;
        type?: "png" | "jpeg" | "webp";
    }
    Index
    animations?: "allow" | "disabled"

    When set to "disabled", stops CSS animations, CSS transitions and Web Animations. Animations get different treatment depending on their duration:

    • finite animations are fast-forwarded to completion, so they'll fire transitionend event.
    • infinite animations are canceled to initial state, and then played over after the screenshot.

    Defaults to "allow" that leaves animations untouched.

    caret?: "hide" | "initial"

    When set to "hide", screenshot will hide text caret. When set to "initial", text caret behavior will not be changed. Defaults to "hide".

    mask?: Locator[]

    Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box #FF00FF (customized by maskColor) that completely covers its bounding box. The mask is also applied to invisible elements, see Matching only visible elements to disable that.

    maskColor?: string

    Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink #FF00FF.

    omitBackground?: boolean

    Hides default white background and allows capturing screenshots with transparency. Not applicable to jpeg images. Defaults to false.

    path?: string

    The file path to save the image to. The screenshot type will be inferred from file extension. If path is a relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be saved to the disk.

    quality?: number

    The quality of the image, between 0-100. Not applicable to png images. For jpeg the default is 80. For webp, a quality of 100 (the default) produces a lossless image, while lower values use lossy compression.

    scale?: "css" | "device"

    When set to "css", screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, this will keep screenshots small. Using "device" option will produce a single pixel per each device pixel, so screenshots of high-dpi devices will be twice as large or even larger.

    Defaults to "device".

    signal?: AbortSignal

    Allows to cancel the operation using an AbortSignal. If the signal is aborted, the operation will be aborted and throw an error. Note that providing a signal does not disable the default timeout, which can be changed using browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout); pass timeout: 0 to disable the timeout entirely.

    style?: string

    Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM and applies to the inner frames.

    timeout?: number

    Maximum time in milliseconds. Defaults to 0 - no timeout. The default value can be changed via actionTimeout option in the config, or by using the browserContext.setDefaultTimeout(timeout) or page.setDefaultTimeout(timeout) methods.

    type?: "png" | "jpeg" | "webp"

    Specify screenshot type, defaults to png.