effect-playwright
    Preparing search index...

    Interface Locator

    Effect-friendly operations for a Playwright locator.

    When to use

    Use locators for resilient element selection, interaction, assertions, and browser-side evaluation. Locator-producing operations are synchronous; operations that query or interact with the page return Effect.

    0.1.0

    interface Locator {
        _raw: Locator;
        all: () => Effect<readonly Playwright.Locator[], PlaywrightError>;
        allInnerTexts: () => Effect<readonly string[], PlaywrightError>;
        allTextContents: () => Effect<readonly string[], PlaywrightError>;
        and: (locator: Playwright.Locator | Locator) => Playwright.Locator;
        ariaSnapshot: (
            options?: {
                boxes?: boolean;
                depth?: number;
                mode?: "default" | "ai";
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<string, PlaywrightError>;
        blur: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<void, PlaywrightError>;
        boundingBox: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<
            Option<{ height: number; width: number; x: number; y: number }>,
            PlaywrightError,
        >;
        check: (
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        clear: (
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<void, PlaywrightError>;
        click: (
            options?: {
                button?: "left" | "right" | "middle";
                clickCount?: number;
                delay?: number;
                force?: boolean;
                modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                steps?: number;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        contentFrame: () => Playwright.FrameLocator;
        count: Effect<number, PlaywrightError>;
        dblclick: (
            options?: {
                button?: "left" | "right" | "middle";
                delay?: number;
                force?: boolean;
                modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                steps?: number;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        describe: (description: string) => Playwright.Locator;
        description: () => Option<string>;
        dispatchEvent: (
            type: string,
            eventInit?: EvaluationArgument,
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<void, PlaywrightError>;
        dragTo: (
            target: Playwright.Locator | Locator,
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                sourcePosition?: { x: number; y: number };
                steps?: number;
                targetPosition?: { x: number; y: number };
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        drop: (
            data: {
                data?: { [key: string]: string };
                files?:
                    | string
                    | string[]
                    | { buffer: Buffer; mimeType: string; name: string }
                    | { buffer: Buffer; mimeType: string; name: string }[];
            },
            options?: {
                position?: { x: number; y: number };
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<void, PlaywrightError>;
        elementHandle: (
            options?: { timeout?: number },
        ) => Effect<
            Option<ElementHandle<SVGElement | HTMLElement>>,
            PlaywrightError,
        >;
        elementHandles: () => Effect<
            readonly ElementHandle<SVGElement | HTMLElement>[],
            PlaywrightError,
        >;
        evaluate: <
            R,
            Arg = void,
            E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
        >(
            pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>,
            arg?: Arg,
            options?: {
                exposeFunctions?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<R, PlaywrightError>;
        evaluateAll: <
            R,
            Arg = void,
            E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
        >(
            pageFunction: (elements: E[], arg: Unboxed<Arg>) => R | Promise<R>,
            arg?: Arg,
        ) => Effect<R, PlaywrightError>;
        evaluateHandle: <
            R,
            Arg = void,
            E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
        >(
            pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>,
            arg?: Arg,
            options?: {
                exposeFunctions?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<JSHandle<R>, PlaywrightError>;
        fill: (
            value: string,
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<void, PlaywrightError>;
        filter: (
            options?: {
                has?: Locator;
                hasNot?: Locator;
                hasNotText?: string | RegExp;
                hasText?: string | RegExp;
                visible?: boolean;
            },
        ) => Playwright.Locator;
        first: () => Playwright.Locator;
        focus: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<void, PlaywrightError>;
        frameLocator: (selector: string) => Playwright.FrameLocator;
        getAttribute: (
            name: string,
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<string | null, PlaywrightError>;
        getByAltText: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => Playwright.Locator;
        getByLabel: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => Playwright.Locator;
        getByPlaceholder: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => Playwright.Locator;
        getByRole: (
            role:
                | "alert"
                | "alertdialog"
                | "application"
                | "article"
                | "banner"
                | "blockquote"
                | "button"
                | "caption"
                | "cell"
                | "checkbox"
                | "code"
                | "columnheader"
                | "combobox"
                | "complementary"
                | "contentinfo"
                | "definition"
                | "deletion"
                | "dialog"
                | "directory"
                | "document"
                | "emphasis"
                | "feed"
                | "figure"
                | "form"
                | "generic"
                | "grid"
                | "gridcell"
                | "group"
                | "heading"
                | "img"
                | "insertion"
                | "link"
                | "list"
                | "listbox"
                | "listitem"
                | "log"
                | "main"
                | "marquee"
                | "math"
                | "meter"
                | "menu"
                | "menubar"
                | "menuitem"
                | "menuitemcheckbox"
                | "menuitemradio"
                | "navigation"
                | "none"
                | "note"
                | "option"
                | "paragraph"
                | "presentation"
                | "progressbar"
                | "radio"
                | "radiogroup"
                | "region"
                | "row"
                | "rowgroup"
                | "rowheader"
                | "scrollbar"
                | "search"
                | "searchbox"
                | "separator"
                | "slider"
                | "spinbutton"
                | "status"
                | "strong"
                | "subscript"
                | "superscript"
                | "switch"
                | "tab"
                | "table"
                | "tablist"
                | "tabpanel"
                | "term"
                | "textbox"
                | "time"
                | "timer"
                | "toolbar"
                | "tooltip"
                | "tree"
                | "treegrid"
                | "treeitem",
            options?: {
                checked?: boolean;
                description?: string | RegExp;
                disabled?: boolean;
                exact?: boolean;
                expanded?: boolean;
                includeHidden?: boolean;
                level?: number;
                name?: string | RegExp;
                pressed?: boolean;
                selected?: boolean;
            },
        ) => Playwright.Locator;
        getByTestId: (testId: string | RegExp) => Playwright.Locator;
        getByText: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => Playwright.Locator;
        getByTitle: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => Playwright.Locator;
        hideHighlight: Effect<void, PlaywrightError>;
        highlight: (
            options?: { style?: string | { [key: string]: string | number } },
        ) => Effect<void, PlaywrightError>;
        hover: (
            options?: {
                force?: boolean;
                modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        innerHTML: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<string, PlaywrightError>;
        innerText: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<string, PlaywrightError>;
        inputValue: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<string, PlaywrightError>;
        isChecked: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<boolean, PlaywrightError>;
        isDisabled: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<boolean, PlaywrightError>;
        isEditable: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<boolean, PlaywrightError>;
        isEnabled: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<boolean, PlaywrightError>;
        isHidden: (
            options?: { timeout?: number },
        ) => Effect<boolean, PlaywrightError>;
        isVisible: (
            options?: { timeout?: number },
        ) => Effect<boolean, PlaywrightError>;
        last: () => Playwright.Locator;
        locator: (
            selectorOrLocator: string | Playwright.Locator | Locator,
            options?: {
                has?: Locator;
                hasNot?: Locator;
                hasNotText?: string | RegExp;
                hasText?: string | RegExp;
            },
        ) => Playwright.Locator;
        normalize: () => Effect<Playwright.Locator, PlaywrightError>;
        nth: (index: number) => Playwright.Locator;
        or: (locator: Playwright.Locator | Locator) => Playwright.Locator;
        page: () => Playwright.Page;
        press: (
            key: string,
            options?: {
                delay?: number;
                noWaitAfter?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<void, PlaywrightError>;
        pressSequentially: (
            text: string,
            options?: {
                delay?: number;
                noWaitAfter?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<void, PlaywrightError>;
        screenshot: (
            options?: LocatorScreenshotOptions,
        ) => Effect<Buffer<ArrayBufferLike>, PlaywrightError>;
        scrollIntoViewIfNeeded: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<void, PlaywrightError>;
        selectOption: (
            values:
                | string
                | ElementHandle<Node>
                | readonly string[]
                | { index?: number; label?: string; value?: string }
                | readonly ElementHandle<Node>[]
                | readonly { index?: number; label?: string; value?: string }[]
                | null,
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<readonly string[], PlaywrightError>;
        selectText: (
            options?: { force?: boolean; signal?: AbortSignal; timeout?: number },
        ) => Effect<void, PlaywrightError>;
        setChecked: (
            checked: boolean,
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        setInputFiles: (
            files:
                | string
                | readonly string[]
                | { buffer: Buffer; mimeType: string; name: string }
                | readonly { buffer: Buffer; mimeType: string; name: string }[],
            options?: {
                noWaitAfter?: boolean;
                signal?: AbortSignal;
                timeout?: number;
            },
        ) => Effect<void, PlaywrightError>;
        tap: (
            options?: {
                force?: boolean;
                modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        textContent: (
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<string | null, PlaywrightError>;
        toString: () => string;
        uncheck: (
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                scroll?: "none" | "auto";
                signal?: AbortSignal;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        use: <T>(f: (locator: Locator) => Promise<T>) => Effect<T, PlaywrightError>;
        waitFor: (
            options?: {
                signal?: AbortSignal;
                state?: "attached" | "detached" | "visible" | "hidden";
                timeout?: number;
            },
        ) => Effect<void, PlaywrightError>;
        waitForFunction: <
            R,
            Arg = void,
            E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
        >(
            pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>,
            arg?: Arg,
            options?: { signal?: AbortSignal; timeout?: number },
        ) => Effect<void, PlaywrightError>;
    }
    Index
    _raw: Locator

    The underlying Playwright Locator instance.

    all: () => Effect<readonly Playwright.Locator[], PlaywrightError>

    Returns an array of locators pointing to the matched elements.

    0.4.1

    allInnerTexts: () => Effect<readonly string[], PlaywrightError>

    Gets all inner texts.

    allTextContents: () => Effect<readonly string[], PlaywrightError>

    Gets all text contents.

    Creates a locator that matches both this locator and the argument locator.

    0.4.1

    ariaSnapshot: (
        options?: {
            boxes?: boolean;
            depth?: number;
            mode?: "default" | "ai";
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<string, PlaywrightError>

    Returns the accessibility tree snapshot.

    0.1.0

    blur: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<void, PlaywrightError>

    Removes keyboard focus from the current element.

    0.4.2

    boundingBox: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<
        Option<{ height: number; width: number; x: number; y: number }>,
        PlaywrightError,
    >

    Returns the bounding box of the element.

    0.1.0

    check: (
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            position?: { x: number; y: number };
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Checks the element.

    0.1.0

    clear: (
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<void, PlaywrightError>

    Clear the input field.

    0.4.2

    click: (
        options?: {
            button?: "left" | "right" | "middle";
            clickCount?: number;
            delay?: number;
            force?: boolean;
            modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
            noWaitAfter?: boolean;
            position?: { x: number; y: number };
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            steps?: number;
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Clicks the element.

    0.1.0

    contentFrame: () => Playwright.FrameLocator

    Returns a FrameLocator object pointing to the same iframe as this locator.

    0.4.1

    count: Effect<number, PlaywrightError>

    Counts the number of matched elements.

    0.1.0

    dblclick: (
        options?: {
            button?: "left" | "right" | "middle";
            delay?: number;
            force?: boolean;
            modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
            noWaitAfter?: boolean;
            position?: { x: number; y: number };
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            steps?: number;
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Double-clicks the element.

    0.4.2

    describe: (description: string) => Playwright.Locator

    Describes the locator.

    0.1.0

    description: () => Option<string>

    Returns the description of the locator.

    0.1.0

    dispatchEvent: (
        type: string,
        eventInit?: EvaluationArgument,
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<void, PlaywrightError>

    Dispatches an event.

    dragTo: (
        target: Playwright.Locator | Locator,
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            sourcePosition?: { x: number; y: number };
            steps?: number;
            targetPosition?: { x: number; y: number };
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Drags the locator to another target locator.

    0.4.2

    drop: (
        data: {
            data?: { [key: string]: string };
            files?:
                | string
                | string[]
                | { buffer: Buffer; mimeType: string; name: string }
                | { buffer: Buffer; mimeType: string; name: string }[];
        },
        options?: {
            position?: { x: number; y: number };
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<void, PlaywrightError>

    Drops the locator.

    0.5.0

    elementHandle: (
        options?: { timeout?: number },
    ) => Effect<
        Option<ElementHandle<SVGElement | HTMLElement>>,
        PlaywrightError,
    >

    Resolves given locator to the first matching DOM element.

    elementHandles: () => Effect<
        readonly ElementHandle<SVGElement | HTMLElement>[],
        PlaywrightError,
    >

    Resolves given locator to all matching DOM elements.

    evaluate: <
        R,
        Arg = void,
        E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
    >(
        pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>,
        arg?: Arg,
        options?: {
            exposeFunctions?: boolean;
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<R, PlaywrightError>

    Evaluates a function on the matched element.

    Example (Evaluating the matched element)

    import { Effect } from "effect";
    import { Playwright } from "effect-playwright";

    const buttonContent = Effect.gen(function* () {
    const page = yield* Playwright.Page;
    const locator = page.locator("button");
    return yield* locator.evaluate((button) => button.textContent);
    });

    0.1.0

    evaluateAll: <
        R,
        Arg = void,
        E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
    >(
        pageFunction: (elements: E[], arg: Unboxed<Arg>) => R | Promise<R>,
        arg?: Arg,
    ) => Effect<R, PlaywrightError>

    Evaluates a function on all matched elements.

    0.3.0

    evaluateHandle: <
        R,
        Arg = void,
        E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
    >(
        pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>,
        arg?: Arg,
        options?: {
            exposeFunctions?: boolean;
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<JSHandle<R>, PlaywrightError>

    Evaluates a function on the matched element and returns the result as a handle.

    fill: (
        value: string,
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<void, PlaywrightError>

    Fills the input field.

    0.1.0

    filter: (
        options?: {
            has?: Locator;
            hasNot?: Locator;
            hasNotText?: string | RegExp;
            hasText?: string | RegExp;
            visible?: boolean;
        },
    ) => Playwright.Locator

    Narrows existing locator according to the options.

    0.4.1

    first: () => Playwright.Locator

    Returns a locator that points to the first matched element.

    0.1.0

    focus: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<void, PlaywrightError>

    Focuses the element.

    0.4.2

    frameLocator: (selector: string) => Playwright.FrameLocator

    Creates a frame locator that will enter the iframe and allow selecting elements in that iframe.

    0.4.1

    getAttribute: (
        name: string,
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<string | null, PlaywrightError>

    Gets an attribute value.

    0.1.0

    getByAltText: (
        text: string | RegExp,
        options?: { exact?: boolean },
    ) => Playwright.Locator

    Allows locating elements by their alt text.

    0.1.0

    getByLabel: (
        text: string | RegExp,
        options?: { exact?: boolean },
    ) => Playwright.Locator

    Allows locating elements by their label text.

    0.1.0

    getByPlaceholder: (
        text: string | RegExp,
        options?: { exact?: boolean },
    ) => Playwright.Locator

    Allows locating elements by their placeholder text.

    getByRole: (
        role:
            | "alert"
            | "alertdialog"
            | "application"
            | "article"
            | "banner"
            | "blockquote"
            | "button"
            | "caption"
            | "cell"
            | "checkbox"
            | "code"
            | "columnheader"
            | "combobox"
            | "complementary"
            | "contentinfo"
            | "definition"
            | "deletion"
            | "dialog"
            | "directory"
            | "document"
            | "emphasis"
            | "feed"
            | "figure"
            | "form"
            | "generic"
            | "grid"
            | "gridcell"
            | "group"
            | "heading"
            | "img"
            | "insertion"
            | "link"
            | "list"
            | "listbox"
            | "listitem"
            | "log"
            | "main"
            | "marquee"
            | "math"
            | "meter"
            | "menu"
            | "menubar"
            | "menuitem"
            | "menuitemcheckbox"
            | "menuitemradio"
            | "navigation"
            | "none"
            | "note"
            | "option"
            | "paragraph"
            | "presentation"
            | "progressbar"
            | "radio"
            | "radiogroup"
            | "region"
            | "row"
            | "rowgroup"
            | "rowheader"
            | "scrollbar"
            | "search"
            | "searchbox"
            | "separator"
            | "slider"
            | "spinbutton"
            | "status"
            | "strong"
            | "subscript"
            | "superscript"
            | "switch"
            | "tab"
            | "table"
            | "tablist"
            | "tabpanel"
            | "term"
            | "textbox"
            | "time"
            | "timer"
            | "toolbar"
            | "tooltip"
            | "tree"
            | "treegrid"
            | "treeitem",
        options?: {
            checked?: boolean;
            description?: string | RegExp;
            disabled?: boolean;
            exact?: boolean;
            expanded?: boolean;
            includeHidden?: boolean;
            level?: number;
            name?: string | RegExp;
            pressed?: boolean;
            selected?: boolean;
        },
    ) => Playwright.Locator

    Allows locating elements by their ARIA role, ARIA attributes and accessible name.

    0.1.0

    getByTestId: (testId: string | RegExp) => Playwright.Locator

    Allows locating elements by their test id.

    0.1.0

    getByText: (
        text: string | RegExp,
        options?: { exact?: boolean },
    ) => Playwright.Locator

    Allows locating elements that contain given text.

    0.1.0

    getByTitle: (
        text: string | RegExp,
        options?: { exact?: boolean },
    ) => Playwright.Locator

    Allows locating elements by their title attribute.

    0.1.0

    hideHighlight: Effect<void, PlaywrightError>

    Hides the element highlight previously added by highlight.

    highlight: (
        options?: { style?: string | { [key: string]: string | number } },
    ) => Effect<void, PlaywrightError>

    Highlights the corresponding element(s) on the screen.

    0.4.1

    hover: (
        options?: {
            force?: boolean;
            modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
            noWaitAfter?: boolean;
            position?: { x: number; y: number };
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Hovers over the element.

    0.4.2

    innerHTML: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<string, PlaywrightError>

    Gets the inner HTML.

    0.1.0

    innerText: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<string, PlaywrightError>

    Gets the inner text.

    0.1.0

    inputValue: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<string, PlaywrightError>

    Gets the input value.

    0.1.0

    isChecked: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<boolean, PlaywrightError>

    Returns whether the element is checked.

    0.4.1

    isDisabled: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<boolean, PlaywrightError>

    Returns whether the element is disabled.

    0.4.1

    isEditable: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<boolean, PlaywrightError>

    Returns whether the element is editable.

    0.4.1

    isEnabled: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<boolean, PlaywrightError>

    Returns whether the element is enabled.

    0.4.1

    isHidden: (options?: { timeout?: number }) => Effect<boolean, PlaywrightError>

    Returns whether the element is hidden.

    0.4.1

    isVisible: (options?: { timeout?: number }) => Effect<boolean, PlaywrightError>

    Returns whether the element is visible.

    0.4.1

    last: () => Playwright.Locator

    Returns a locator that points to the last matched element.

    0.1.0

    locator: (
        selectorOrLocator: string | Playwright.Locator | Locator,
        options?: {
            has?: Locator;
            hasNot?: Locator;
            hasNotText?: string | RegExp;
            hasText?: string | RegExp;
        },
    ) => Playwright.Locator

    Returns a locator that points to a matched element.

    0.1.0

    Normalizes the locator.

    0.5.0

    nth: (index: number) => Playwright.Locator

    Returns a locator that points to the nth matched element.

    0.1.0

    Creates a locator that matches either this locator or the argument locator.

    0.4.1

    page: () => Playwright.Page

    A page this locator belongs to.

    0.4.1

    press: (
        key: string,
        options?: {
            delay?: number;
            noWaitAfter?: boolean;
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<void, PlaywrightError>

    Focuses the element, and then uses keyboard.down and keyboard.up.

    0.4.2

    pressSequentially: (
        text: string,
        options?: {
            delay?: number;
            noWaitAfter?: boolean;
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<void, PlaywrightError>

    Focuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.

    screenshot: (
        options?: LocatorScreenshotOptions,
    ) => Effect<Buffer<ArrayBufferLike>, PlaywrightError>

    Captures a screenshot of the element.

    0.4.1

    scrollIntoViewIfNeeded: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<void, PlaywrightError>

    Scrolls the element into view if needed.

    selectOption: (
        values:
            | string
            | ElementHandle<Node>
            | readonly string[]
            | { index?: number; label?: string; value?: string }
            | readonly ElementHandle<Node>[]
            | readonly { index?: number; label?: string; value?: string }[]
            | null,
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            signal?: AbortSignal;
            timeout?: number;
        },
    ) => Effect<readonly string[], PlaywrightError>

    Selects an option in a <select> element.

    0.4.2

    selectText: (
        options?: { force?: boolean; signal?: AbortSignal; timeout?: number },
    ) => Effect<void, PlaywrightError>

    Selects text.

    0.4.2

    setChecked: (
        checked: boolean,
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            position?: { x: number; y: number };
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Checks the element if not already checked.

    0.4.2

    setInputFiles: (
        files:
            | string
            | readonly string[]
            | { buffer: Buffer; mimeType: string; name: string }
            | readonly { buffer: Buffer; mimeType: string; name: string }[],
        options?: { noWaitAfter?: boolean; signal?: AbortSignal; timeout?: number },
    ) => Effect<void, PlaywrightError>

    Sets the value of the file input.

    tap: (
        options?: {
            force?: boolean;
            modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
            noWaitAfter?: boolean;
            position?: { x: number; y: number };
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Taps the element.

    0.4.2

    textContent: (
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<string | null, PlaywrightError>

    Gets the text content.

    0.1.0

    toString: () => string

    Returns the string representation of the locator.

    0.4.1

    uncheck: (
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            position?: { x: number; y: number };
            scroll?: "none" | "auto";
            signal?: AbortSignal;
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Unchecks the element.

    0.4.2

    use: <T>(f: (locator: Locator) => Promise<T>) => Effect<T, PlaywrightError>

    Runs an asynchronous operation against the underlying Playwright Locator.

    When to use

    Use this escape hatch only when Locator does not expose the native Playwright operation you need.

    Gotchas

    The callback must return a Promise. Prefer the wrapper API so Playwright failures remain represented by the documented wrapper operations.

    Type Declaration

      • <T>(f: (locator: Locator) => Promise<T>): Effect<T, PlaywrightError>
      • Type Parameters

        • T

        Parameters

        • f: (locator: Locator) => Promise<T>

          A function that receives the native locator and returns a promise.

        Returns Effect<T, PlaywrightError>

        An effect that maps a rejected promise to PlaywrightError.

    import { Effect } from "effect";
    import { Playwright } from "effect-playwright";

    const program = Effect.gen(function* () {
    const locator = yield* Playwright.Locator;
    return yield* locator.use((nativeLocator) => nativeLocator.isVisible());
    });

    0.1.0

    waitFor: (
        options?: {
            signal?: AbortSignal;
            state?: "attached" | "detached" | "visible" | "hidden";
            timeout?: number;
        },
    ) => Effect<void, PlaywrightError>

    Returns when element specified by locator satisfies the state option.

    0.1.0

    waitForFunction: <
        R,
        Arg = void,
        E extends SVGElement | HTMLElement = SVGElement | HTMLElement,
    >(
        pageFunction: (element: E, arg: Unboxed<Arg>) => R | Promise<R>,
        arg?: Arg,
        options?: { signal?: AbortSignal; timeout?: number },
    ) => Effect<void, PlaywrightError>

    Returns when the matched element satisfies the provided predicate.

    import { chromium } from "@playwright/test";
    import { Effect } from "effect";
    import { Playwright, PlaywrightSpawner } from "effect-playwright";

    const program = Effect.gen(function* () {
    const browser = yield* Playwright.Browser;
    const page = yield* browser.newPage();
    yield* page.setContent('<div id="status">Ready</div>');
    yield* page.locator("#status").waitForFunction(
    (element, expected) => element.textContent === expected,
    "Ready",
    );
    }).pipe(
    PlaywrightSpawner.withBrowser,
    Effect.provide(PlaywrightSpawner.layer(chromium)),
    );

    0.5.1