effect-playwright
    Preparing search index...

    Interface PlaywrightBrowserContextService

    0.1.0

    interface PlaywrightBrowserContextService {
        addCookies: (
            cookies: readonly {
                domain?: string;
                expires?: number;
                httpOnly?: boolean;
                name: string;
                partitionKey?: string;
                path?: string;
                sameSite?: "None" | "Strict" | "Lax";
                secure?: boolean;
                url?: string;
                value: string;
            }[],
        ) => Effect<void, PlaywrightError>;
        addInitScript: (
            script:
                | PageFunction<unknown, any>
                | { content?: string; path?: string },
            arg?: unknown,
        ) => Effect<void, PlaywrightError>;
        browser: () => Option<PlaywrightBrowserService>;
        clearCookies: (
            options?: {
                domain?: string | RegExp;
                name?: string | RegExp;
                path?: string | RegExp;
            },
        ) => Effect<void, PlaywrightError>;
        clearPermissions: Effect<void, PlaywrightError>;
        clock: PlaywrightClockService;
        close: Effect<void, PlaywrightError>;
        cookies: (urls?: string | string[]) => Effect<Cookie[], PlaywrightError>;
        eventStream: <
            K extends
                | "dialog"
                | "page"
                | "close"
                | "console"
                | "request"
                | "requestfailed"
                | "requestfinished"
                | "response"
                | "backgroundpage"
                | "serviceworker"
                | "weberror",
        >(
            event: K,
        ) => Stream<
            ReturnType<
                {
                    backgroundpage: (page: Page) => PlaywrightPageService;
                    close: (context: BrowserContext) => PlaywrightBrowserContextService;
                    console: (a: ConsoleMessage) => ConsoleMessage;
                    dialog: (dialog: Dialog) => PlaywrightDialog;
                    page: (page: Page) => PlaywrightPageService;
                    request: (request: Request) => PlaywrightRequest;
                    requestfailed: (request: Request) => PlaywrightRequest;
                    requestfinished: (request: Request) => PlaywrightRequest;
                    response: (response: Response) => PlaywrightResponse;
                    serviceworker: (worker: Worker) => PlaywrightWorker;
                    weberror: (a: WebError) => WebError;
                }[K],
            >,
        >;
        grantPermissions: (
            permissions: readonly string[],
            options?: { origin?: string },
        ) => Effect<void, PlaywrightError>;
        newPage: Effect<PlaywrightPageService, PlaywrightError>;
        pages: () => PlaywrightPageService[];
        setDefaultNavigationTimeout: (timeout: number) => void;
        setDefaultTimeout: (timeout: number) => void;
        setExtraHTTPHeaders: (
            headers: { [key: string]: string },
        ) => Effect<void, PlaywrightError>;
        setGeolocation: (
            geolocation:
                | { accuracy?: number; latitude: number; longitude: number }
                | null,
        ) => Effect<void, PlaywrightError>;
        setOffline: (offline: boolean) => Effect<void, PlaywrightError>;
    }
    Index

    other

    addCookies: (
        cookies: readonly {
            domain?: string;
            expires?: number;
            httpOnly?: boolean;
            name: string;
            partitionKey?: string;
            path?: string;
            sameSite?: "None" | "Strict" | "Lax";
            secure?: boolean;
            url?: string;
            value: string;
        }[],
    ) => Effect<void, PlaywrightError>

    Sets the cookies for the browser context.

    BrowserContext.addCookies

    0.4.0

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

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

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

    BrowserContext.addInitScript

    0.2.0

    browser: () => Option<PlaywrightBrowserService>

    Returns the browser that the context belongs to.

    BrowserContext.browser

    0.4.0

    clearCookies: (
        options?: {
            domain?: string | RegExp;
            name?: string | RegExp;
            path?: string | RegExp;
        },
    ) => Effect<void, PlaywrightError>

    Clears the cookies from the browser context.

    BrowserContext.clearCookies

    0.4.0

    clearPermissions: Effect<void, PlaywrightError>

    Clears the permissions from the browser context.

    BrowserContext.clearPermissions

    0.4.0

    Access the clock.

    close: Effect<void, PlaywrightError>

    Closes the browser context.

    0.1.0

    cookies: (urls?: string | string[]) => Effect<Cookie[], PlaywrightError>

    Returns the cookies for the browser context.

    BrowserContext.cookies

    0.4.0

    grantPermissions: (
        permissions: readonly string[],
        options?: { origin?: string },
    ) => Effect<void, PlaywrightError>

    Grants permissions to the browser context.

    BrowserContext.grantPermissions

    0.4.0

    Opens a new page in the browser context.

    const page = yield* context.newPage;
    

    0.1.0

    pages: () => PlaywrightPageService[]

    Returns the list of all open pages in the browser context.

    0.1.0

    setDefaultNavigationTimeout: (timeout: number) => void

    Sets the default navigation timeout for the browser context.

    BrowserContext.setDefaultNavigationTimeout

    0.4.0

    setDefaultTimeout: (timeout: number) => void

    Sets the default timeout for the browser context.

    BrowserContext.setDefaultTimeout

    0.4.0

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

    Sets the extra HTTP headers for the browser context.

    BrowserContext.setExtraHTTPHeaders

    0.4.0

    setGeolocation: (
        geolocation:
            | { accuracy?: number; latitude: number; longitude: number }
            | null,
    ) => Effect<void, PlaywrightError>

    Sets the geolocation for the browser context.

    BrowserContext.setGeolocation

    0.4.0

    setOffline: (offline: boolean) => Effect<void, PlaywrightError>

    Sets the offline state for the browser context.

    BrowserContext.setOffline

    0.4.0

    custom

    eventStream: <
        K extends
            | "dialog"
            | "page"
            | "close"
            | "console"
            | "request"
            | "requestfailed"
            | "requestfinished"
            | "response"
            | "backgroundpage"
            | "serviceworker"
            | "weberror",
    >(
        event: K,
    ) => Stream<
        ReturnType<
            {
                backgroundpage: (page: Page) => PlaywrightPageService;
                close: (context: BrowserContext) => PlaywrightBrowserContextService;
                console: (a: ConsoleMessage) => ConsoleMessage;
                dialog: (dialog: Dialog) => PlaywrightDialog;
                page: (page: Page) => PlaywrightPageService;
                request: (request: Request) => PlaywrightRequest;
                requestfailed: (request: Request) => PlaywrightRequest;
                requestfinished: (request: Request) => PlaywrightRequest;
                response: (response: Response) => PlaywrightResponse;
                serviceworker: (worker: Worker) => PlaywrightWorker;
                weberror: (a: WebError) => WebError;
            }[K],
        >,
    >

    Creates a stream of the given event from the browser context.

    const pageStream = context.eventStream("page");
    

    0.1.2