effect-playwright
    Preparing search index...

    Interface PlaywrightPageService

    0.1.0

    interface PlaywrightPageService {
        click: (
            selector: string,
            options?: {
                button?: "left" | "right" | "middle";
                clickCount?: number;
                delay?: number;
                force?: boolean;
                modifiers?: ("Alt" | "Control" | "ControlOrMeta" | "Meta" | "Shift")[];
                noWaitAfter?: boolean;
                position?: { x: number; y: number };
                strict?: boolean;
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        close: Effect<void, PlaywrightError>;
        evaluate: <R, Arg = void>(
            pageFunction: PageFunction<Arg, R>,
            arg?: Arg,
        ) => Effect<R, PlaywrightError>;
        eventStream: <K extends keyof PageEvents>(
            event: K,
        ) => Stream<
            ReturnType<
                {
                    close: (page: Page) => PlaywrightPageService;
                    console: (a: ConsoleMessage) => ConsoleMessage;
                    crash: (page: Page) => PlaywrightPageService;
                    dialog: (dialog: Dialog) => PlaywrightDialog;
                    domcontentloaded: (page: Page) => PlaywrightPageService;
                    download: (download: Download) => PlaywrightDownload;
                    filechooser: (fileChooser: FileChooser) => PlaywrightFileChooser;
                    frameattached: (frame: Frame) => PlaywrightFrameService;
                    framedetached: (frame: Frame) => PlaywrightFrameService;
                    framenavigated: (frame: Frame) => PlaywrightFrameService;
                    load: (page: Page) => PlaywrightPageService;
                    pageerror: (a: Error) => Error;
                    popup: (page: Page) => PlaywrightPageService;
                    request: (request: Request) => PlaywrightRequest;
                    requestfailed: (request: Request) => PlaywrightRequest;
                    requestfinished: (request: Request) => PlaywrightRequest;
                    response: (response: Response) => PlaywrightResponse;
                    websocket: (a: WebSocket) => WebSocket;
                    worker: (worker: Worker) => PlaywrightWorker;
                }[K],
            >,
        >;
        frames: Effect<readonly PlaywrightFrameService[], PlaywrightError>;
        getByLabel: (
            label: string | RegExp,
            options?: { exact?: boolean },
        ) => PlaywrightLocatorService;
        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;
                disabled?: boolean;
                exact?: boolean;
                expanded?: boolean;
                includeHidden?: boolean;
                level?: number;
                name?: string | RegExp;
                pressed?: boolean;
                selected?: boolean;
            },
        ) => PlaywrightLocatorService;
        getByTestId: (testId: string | RegExp) => PlaywrightLocatorService;
        getByText: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => PlaywrightLocatorService;
        goto: (
            url: string,
            options?: {
                referer?: string;
                timeout?: number;
                waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
            },
        ) => Effect<void, PlaywrightError>;
        locator: (
            selector: string,
            options?: {
                has?: Locator;
                hasNot?: Locator;
                hasNotText?: string | RegExp;
                hasText?: string | RegExp;
            },
        ) => PlaywrightLocatorService;
        reload: Effect<void, PlaywrightError>;
        title: Effect<string, PlaywrightError>;
        url: Effect<string, PlaywrightError>;
        use: <T>(f: (page: Page) => Promise<T>) => Effect<T, PlaywrightError>;
        waitForLoadState: (
            state?: "load" | "domcontentloaded" | "networkidle",
            options?: { timeout?: number },
        ) => Effect<void, PlaywrightError>;
        waitForURL: (
            url: string | RegExp | ((url: URL) => boolean),
            options?: {
                timeout?: number;
                waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
            },
        ) => Effect<void, PlaywrightError>;
    }
    Index

    other

    close: Effect<void, PlaywrightError>

    Closes the page.

    0.1.0

    evaluate: <R, Arg = void>(
        pageFunction: PageFunction<Arg, R>,
        arg?: Arg,
    ) => Effect<R, PlaywrightError>

    Evaluates a function in the context of the page.

    const dimensions = yield* page.evaluate(() => ({
    width: document.documentElement.clientWidth,
    height: document.documentElement.clientHeight
    }));

    0.1.0

    Returns all frames attached to the page.

    Page.frames

    0.2.0

    getByLabel: (
        label: string | RegExp,
        options?: { exact?: boolean },
    ) => PlaywrightLocatorService

    Returns a locator that matches the given label.

    0.1.0

    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;
            disabled?: boolean;
            exact?: boolean;
            expanded?: boolean;
            includeHidden?: boolean;
            level?: number;
            name?: string | RegExp;
            pressed?: boolean;
            selected?: boolean;
        },
    ) => PlaywrightLocatorService

    Returns a locator that matches the given role.

    0.1.0

    getByTestId: (testId: string | RegExp) => PlaywrightLocatorService

    Returns a locator that matches the given test id.

    0.1.0

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

    Returns a locator that matches the given text.

    0.1.0

    goto: (
        url: string,
        options?: {
            referer?: string;
            timeout?: number;
            waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
        },
    ) => Effect<void, PlaywrightError>

    Navigates the page to the given URL.

    yield* page.goto("https://google.com");
    

    0.1.0

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

    Returns a locator for the given selector.

    0.1.0

    reload: Effect<void, PlaywrightError>

    Reloads the page.

    0.1.0

    title: Effect<string, PlaywrightError>

    Returns the page title.

    const title = yield* page.title;
    

    0.1.0

    url: Effect<string, PlaywrightError>

    Returns the current URL of the page.

    const url = yield* page.url;
    

    0.1.0

    use: <T>(f: (page: Page) => Promise<T>) => Effect<T, PlaywrightError>

    A generic utility to execute any promise-based method on the underlying Playwright Page. Can be used to access any Page functionality not directly exposed by this service.

    const title = yield* page.use((p) => p.title());
    

    Page

    0.1.0

    waitForLoadState: (
        state?: "load" | "domcontentloaded" | "networkidle",
        options?: { timeout?: number },
    ) => Effect<void, PlaywrightError>

    Waits for the page to reach the given load state.

    NOTE: Most of the time, this method is not needed because Playwright auto-waits before every action.

    yield* page.waitForLoadState("domcontentloaded");
    

    Page.waitForLoadState

    0.2.0

    waitForURL: (
        url: string | RegExp | ((url: URL) => boolean),
        options?: {
            timeout?: number;
            waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
        },
    ) => Effect<void, PlaywrightError>

    Waits for the page to navigate to the given URL.

    yield* page.waitForURL("https://google.com");
    

    0.1.0

    custom

    eventStream: <K extends keyof PageEvents>(
        event: K,
    ) => Stream<
        ReturnType<
            {
                close: (page: Page) => PlaywrightPageService;
                console: (a: ConsoleMessage) => ConsoleMessage;
                crash: (page: Page) => PlaywrightPageService;
                dialog: (dialog: Dialog) => PlaywrightDialog;
                domcontentloaded: (page: Page) => PlaywrightPageService;
                download: (download: Download) => PlaywrightDownload;
                filechooser: (fileChooser: FileChooser) => PlaywrightFileChooser;
                frameattached: (frame: Frame) => PlaywrightFrameService;
                framedetached: (frame: Frame) => PlaywrightFrameService;
                framenavigated: (frame: Frame) => PlaywrightFrameService;
                load: (page: Page) => PlaywrightPageService;
                pageerror: (a: Error) => Error;
                popup: (page: Page) => PlaywrightPageService;
                request: (request: Request) => PlaywrightRequest;
                requestfailed: (request: Request) => PlaywrightRequest;
                requestfinished: (request: Request) => PlaywrightRequest;
                response: (response: Response) => PlaywrightResponse;
                websocket: (a: WebSocket) => WebSocket;
                worker: (worker: Worker) => PlaywrightWorker;
            }[K],
        >,
    >

    Creates a stream of the given event from the page.

    const consoleStream = page.eventStream("console");
    

    0.1.0

    deprecated

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

    Clicks an element matching the given selector.

    yield* page.click("button#submit");
    

    Use PlaywrightPageService.locator to create a locator and then call click on it instead.

    0.1.0