effect-playwright
    Preparing search index...

    Interface PlaywrightPageService

    0.1.0

    interface PlaywrightPageService {
        addInitScript: (
            script:
                | { content?: string; path?: string }
                | PageFunction<unknown, any>,
            arg?: unknown,
        ) => Effect<void, PlaywrightError>;
        addScriptTag: (
            options:
                | { content?: string; path?: string; type?: string; url?: string }
                | undefined,
        ) => Effect<ElementHandle<Node>, PlaywrightError>;
        addStyleTag: (
            options: { content?: string; path?: string; url?: string } | undefined,
        ) => Effect<ElementHandle<Node>, PlaywrightError>;
        bringToFront: Effect<void, PlaywrightError>;
        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>;
        clock: PlaywrightClockService;
        close: Effect<void, PlaywrightError>;
        consoleMessages: Effect<readonly ConsoleMessage[], PlaywrightError>;
        content: Effect<string, PlaywrightError>;
        context: () => PlaywrightBrowserContextService;
        dragAndDrop: (
            source: string,
            target: string,
            options?: {
                force?: boolean;
                noWaitAfter?: boolean;
                sourcePosition?: { x: number; y: number };
                steps?: number;
                strict?: boolean;
                targetPosition?: { x: number; y: number };
                timeout?: number;
                trial?: boolean;
            },
        ) => Effect<void, PlaywrightError>;
        emulateMedia: (
            options?: {
                colorScheme?: "light" | "dark" | "no-preference" | null;
                contrast?: "no-preference" | "more" | null;
                forcedColors?: "none" | "active" | null;
                media?: "screen" | "print" | null;
                reducedMotion?: "reduce" | "no-preference" | null;
            },
        ) => 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],
            >,
        >;
        exposeEffect: <A, E, R>(
            name: string,
            playwrightFunction: Effect<A, E, R>,
        ) => Effect<void, PlaywrightError, R>;
        exposeFunction: <A, E, R, Args extends unknown[]>(
            name: string,
            playwrightFunction: (...args: Args) => Effect<A, E, R>,
        ) => Effect<void, PlaywrightError, R>;
        frame: (
            frameSelector:
                | string
                | { name?: string; url?: string
                | RegExp
                | ((url: URL) => boolean) },
        ) => Option<PlaywrightFrameService>;
        frames: Effect<readonly PlaywrightFrameService[], PlaywrightError>;
        getByAltText: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => PlaywrightLocatorService;
        getByLabel: (
            label: string | RegExp,
            options?: { exact?: boolean },
        ) => PlaywrightLocatorService;
        getByPlaceholder: (
            text: 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;
        getByTitle: (
            text: string | RegExp,
            options?: { exact?: boolean },
        ) => PlaywrightLocatorService;
        goBack: (
            options?: {
                timeout?: number;
                waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
            },
        ) => Effect<Option<PlaywrightResponse>, PlaywrightError>;
        goForward: (
            options?: {
                timeout?: number;
                waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
            },
        ) => Effect<Option<PlaywrightResponse>, PlaywrightError>;
        goto: (
            url: string,
            options?: {
                referer?: string;
                timeout?: number;
                waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
            },
        ) => Effect<void, PlaywrightError>;
        isClosed: () => boolean;
        keyboard: PlaywrightKeyboardService;
        locator: (
            selector: string,
            options?: {
                has?: Locator;
                hasNot?: Locator;
                hasNotText?: string | RegExp;
                hasText?: string | RegExp;
            },
        ) => PlaywrightLocatorService;
        mainFrame: () => PlaywrightFrameService;
        mouse: PlaywrightMouseService;
        opener: Effect<Option<PlaywrightPageService>, PlaywrightError>;
        pageErrors: Effect<readonly Error[], PlaywrightError>;
        pause: Effect<void, PlaywrightError>;
        pdf: (
            options?: {
                displayHeaderFooter?: boolean;
                footerTemplate?: string;
                format?: string;
                headerTemplate?: string;
                height?: string | number;
                landscape?: boolean;
                margin?: {
                    bottom?: string | number;
                    left?: string | number;
                    right?: string | number;
                    top?: string | number;
                };
                outline?: boolean;
                pageRanges?: string;
                path?: string;
                preferCSSPageSize?: boolean;
                printBackground?: boolean;
                scale?: number;
                tagged?: boolean;
                width?: string
                | number;
            },
        ) => Effect<Buffer<ArrayBufferLike>, PlaywrightError>;
        reload: Effect<void, PlaywrightError>;
        requestGC: Effect<void, PlaywrightError>;
        screenshot: (
            options?: PageScreenshotOptions,
        ) => Effect<Buffer<ArrayBufferLike>, PlaywrightError>;
        setContent: (
            html: string,
            options?: {
                timeout?: number;
                waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
            },
        ) => Effect<void, PlaywrightError>;
        setDefaultNavigationTimeout: (timeout: number) => void;
        setDefaultTimeout: (timeout: number) => void;
        setExtraHTTPHeaders: (
            headers: { [key: string]: string },
        ) => Effect<void, PlaywrightError>;
        setViewportSize: (
            viewportSize: { height: number; width: number },
        ) => Effect<void, PlaywrightError>;
        title: Effect<string, PlaywrightError>;
        touchscreen: PlaywrightTouchscreenService;
        url: () => string;
        use: <T>(f: (page: Page) => Promise<T>) => Effect<T, PlaywrightError>;
        viewportSize: () => Option<{ height: number; width: number }>;
        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>;
        workers: () => readonly PlaywrightWorker[];
    }
    Index

    other

    addInitScript: (
        script: { content?: string; path?: string } | PageFunction<unknown, any>,
        arg?: unknown,
    ) => Effect<void, PlaywrightError>

    Adds a script which would be evaluated in one of the following scenarios:

    • Whenever the page is navigated.
    • Whenever the child frame is attached or navigated. In this case, the script is evaluated in the context of the newly attached frame.

    Page.addInitScript

    0.3.0

    addScriptTag: (
        options:
            | { content?: string; path?: string; type?: string; url?: string }
            | undefined,
    ) => Effect<ElementHandle<Node>, PlaywrightError>

    Adds a <script> tag into the page with the desired url or content.

    Page.addScriptTag

    0.3.0

    addStyleTag: (
        options: { content?: string; path?: string; url?: string } | undefined,
    ) => Effect<ElementHandle<Node>, PlaywrightError>

    Adds a <link rel="stylesheet"> tag into the page with the desired url or a <style type="text/css"> tag with the content.

    Page.addStyleTag

    0.3.0

    bringToFront: Effect<void, PlaywrightError>

    Brings page to front (activates tab).

    Page.bringToFront

    0.3.0

    Access the clock.

    0.3.0

    close: Effect<void, PlaywrightError>

    Closes the page.

    0.1.0

    consoleMessages: Effect<readonly ConsoleMessage[], PlaywrightError>

    Returns all messages that have been logged to the console.

    const consoleMessages = yield* page.consoleMessages;
    

    Page.consoleMessages

    0.3.0

    content: Effect<string, PlaywrightError>

    Returns the full HTML contents of the page, including the doctype.

    const html = yield* page.content;
    

    Page.content

    0.3.0

    Get the browser context that the page belongs to.

    Page.context

    0.3.0

    dragAndDrop: (
        source: string,
        target: string,
        options?: {
            force?: boolean;
            noWaitAfter?: boolean;
            sourcePosition?: { x: number; y: number };
            steps?: number;
            strict?: boolean;
            targetPosition?: { x: number; y: number };
            timeout?: number;
            trial?: boolean;
        },
    ) => Effect<void, PlaywrightError>

    Drags a source element to a target element and drops it.

    yield* page.dragAndDrop("#source", "#target");
    

    Page.dragAndDrop

    0.3.0

    emulateMedia: (
        options?: {
            colorScheme?: "light" | "dark" | "no-preference" | null;
            contrast?: "no-preference" | "more" | null;
            forcedColors?: "none" | "active" | null;
            media?: "screen" | "print" | null;
            reducedMotion?: "reduce" | "no-preference" | null;
        },
    ) => Effect<void, PlaywrightError>

    This method changes the CSS media type through the media argument, and/or the 'prefers-colors-scheme' media feature, using the colorScheme argument.

    yield* page.emulateMedia({ colorScheme: "dark" });
    yield* page.emulateMedia({ media: "print" });

    Page.emulateMedia

    0.3.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

    exposeEffect: <A, E, R>(
        name: string,
        playwrightFunction: Effect<A, E, R>,
    ) => Effect<void, PlaywrightError, R>

    Identical to exposeFunction but meant to be used with a static Effect. This is useful when the exposed function does not need any arguments and just runs a pre-defined effect in the application context.

    import { Console, Effect } from "effect";
    import { PlaywrightBrowser } from "effect-playwright/browser";

    const program = Effect.gen(function* () {
    const browser = yield* PlaywrightBrowser;
    const page = yield* browser.newPage();

    yield* page.exposeEffect("ping", Console.log("pong"));

    yield* page.evaluate(async () => {
    // @ts-expect-error
    await window.ping();
    });
    });

    Page.exposeFunction

    0.3.0

    exposeFunction: <A, E, R, Args extends unknown[]>(
        name: string,
        playwrightFunction: (...args: Args) => Effect<A, E, R>,
    ) => Effect<void, PlaywrightError, R>

    Adds a function called name on the window object of every frame in this page.

    The provided function must return an Effect which will be executed using the current runtime when the function is called from the browser context.

    If you don't require your function to have args you can use exposeEffect instead.

    import { Console, Effect } from "effect";
    import { PlaywrightBrowser } from "effect-playwright/browser";

    const program = Effect.gen(function* () {
    const browser = yield* PlaywrightBrowser;
    const page = yield* browser.newPage();

    // Expose an Effect-based function to the browser
    yield* page.exposeFunction("logMessage", (message: string) =>
    Console.log(`Message from browser: ${message}`),
    );

    yield* page.evaluate(() => {
    // Call the exposed function from the browser context
    // @ts-expect-error
    return window.logMessage("Hello from the other side!");
    });
    });
    import { Context, Effect } from "effect";
    import { PlaywrightBrowser } from "effect-playwright/browser";

    // A custom Database service used in your Effect application
    class Database extends Context.Tag("Database")<
    Database,
    { readonly insertProduct: (name: string, price: number) => Effect.Effect<void> }
    >() {}

    const program = Effect.gen(function* () {
    const browser = yield* PlaywrightBrowser;
    const page = yield* browser.newPage();

    // Expose a function that seamlessly accesses Effect Context using Effect.fn
    yield* page.exposeFunction(
    "saveProduct",
    Effect.fn(function* (name: string, price: number) {
    const db = yield* Database;
    yield* db.insertProduct(name, price);
    }),
    );

    yield* page.evaluate(async () => {
    // Extract data from the page and save it
    const items = document.querySelectorAll(".product");
    for (const item of items) {
    const name = item.querySelector(".name")?.textContent || "Unknown";
    const price = Number(item.querySelector(".price")?.textContent || 0);

    // Call the Effect function directly from the browser
    // @ts-expect-error
    await window.saveProduct(name, price);
    }
    });
    });

    Page.exposeFunction

    0.3.0

    frame: (
        frameSelector:
            | string
            | { name?: string; url?: string
            | RegExp
            | ((url: URL) => boolean) },
    ) => Option<PlaywrightFrameService>

    Returns a frame matching the specified criteria.

    const frame = Option.getOrNull(page.frame("frame-name"));
    

    Page.frame

    0.3.0

    Returns all frames attached to the page.

    Page.frames

    0.2.0

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

    Returns a locator that matches the given alt text.

    Page.getByAltText

    0.3.0

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

    Returns a locator that matches the given label.

    0.1.0

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

    Returns a locator that matches the given placeholder.

    Page.getByPlaceholder

    0.3.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

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

    Returns a locator that matches the given title.

    Page.getByTitle

    0.3.0

    goBack: (
        options?: {
            timeout?: number;
            waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
        },
    ) => Effect<Option<PlaywrightResponse>, PlaywrightError>

    Navigate to the previous page in history.

    const response = yield* page.goBack();
    

    Page.goBack

    0.3.0

    goForward: (
        options?: {
            timeout?: number;
            waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
        },
    ) => Effect<Option<PlaywrightResponse>, PlaywrightError>

    Navigate to the next page in history.

    const response = yield* page.goForward();
    

    Page.goForward

    0.3.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

    isClosed: () => boolean

    Indicates that the page has been closed.

    Page.isClosed

    0.3.0

    Access the keyboard.

    0.3.0

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

    Returns a locator for the given selector.

    NOTE: This method will cause a defect if options.has or options.hasNot are provided and belong to a different frame.

    0.1.0

    mainFrame: () => PlaywrightFrameService

    The page's main frame. Page is guaranteed to have a main frame which persists during navigations.

    Page.mainFrame

    0.3.0

    Access the mouse.

    0.3.0

    Returns the opener for popup pages and Option.none for others.

    If the opener has been closed already, returns Option.none.

    Page.opener

    0.3.0

    pageErrors: Effect<readonly Error[], PlaywrightError>

    Returns all errors that have been thrown in the page.

    const pageErrors = yield* page.pageErrors;
    

    Page.pageErrors

    0.3.0

    pause: Effect<void, PlaywrightError>

    Pauses the script execution.

    Page.pause

    0.3.0

    pdf: (
        options?: {
            displayHeaderFooter?: boolean;
            footerTemplate?: string;
            format?: string;
            headerTemplate?: string;
            height?: string | number;
            landscape?: boolean;
            margin?: {
                bottom?: string | number;
                left?: string | number;
                right?: string | number;
                top?: string | number;
            };
            outline?: boolean;
            pageRanges?: string;
            path?: string;
            preferCSSPageSize?: boolean;
            printBackground?: boolean;
            scale?: number;
            tagged?: boolean;
            width?: string
            | number;
        },
    ) => Effect<Buffer<ArrayBufferLike>, PlaywrightError>

    Returns the PDF buffer.

    page.pdf() generates a pdf of the page with print css media. To generate a pdf with screen media, call PlaywrightPageService.emulateMedia before calling page.pdf().

    Page.pdf

    0.3.0

    reload: Effect<void, PlaywrightError>

    Reloads the page.

    0.1.0

    requestGC: Effect<void, PlaywrightError>

    Request the page to perform garbage collection. Note that there is no guarantee that all unreachable objects will be collected.

    Page.requestGC

    0.3.0

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

    Captures a screenshot of the page.

    const buffer = yield* page.screenshot({ path: "screenshot.png" });
    

    Page.screenshot

    0.3.0

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

    This method internally calls document.write(), inheriting all its specific characteristics and behaviors.

    Page.setContent

    0.3.0

    setDefaultNavigationTimeout: (timeout: number) => void

    Page.setDefaultNavigationTimeout

    0.3.0

    setDefaultTimeout: (timeout: number) => void

    This setting will change the default maximum time for all the methods accepting timeout option.

    Page.setDefaultTimeout

    0.3.0

    setExtraHTTPHeaders: (
        headers: { [key: string]: string },
    ) => Effect<void, PlaywrightError>

    The extra HTTP headers will be sent with every request the page initiates.

    Page.setExtraHTTPHeaders

    0.3.0

    setViewportSize: (
        viewportSize: { height: number; width: number },
    ) => Effect<void, PlaywrightError>

    Sets the viewport size for the page.

    Page.setViewportSize

    0.3.0

    title: Effect<string, PlaywrightError>

    Returns the page title.

    const title = yield* page.title;
    

    0.1.0

    Access the touchscreen.

    0.3.0

    url: () => string

    Returns the current URL of the page.

    const url = 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

    viewportSize: () => Option<{ height: number; width: number }>

    Returns the viewport size.

    Page.viewportSize

    0.3.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

    workers: () => readonly PlaywrightWorker[]

    Returns all workers.

    Page.workers

    0.3.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