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"
                | "download"
                | "frameattached"
                | "framedetached"
                | "framenavigated"
                | "request"
                | "requestfailed"
                | "requestfinished"
                | "response"
                | "backgroundpage"
                | "pageclose"
                | "pageload"
                | "serviceworker"
                | "weberror",
        >(
            event: K,
        ) => Stream<
            ReturnType<
                {
                    backgroundpage: (page: Page) => PlaywrightPageService;
                    close: (context: BrowserContext) => PlaywrightBrowserContextService;
                    console: (a: ConsoleMessage) => ConsoleMessage;
                    dialog: (dialog: Dialog) => PlaywrightDialog;
                    download: (download: Download) => PlaywrightDownload;
                    frameattached: (frame: Frame) => PlaywrightFrameService;
                    framedetached: (frame: Frame) => PlaywrightFrameService;
                    framenavigated: (frame: Frame) => PlaywrightFrameService;
                    page: (page: Page) => PlaywrightPageService;
                    pageclose: (page: Page) => PlaywrightPageService;
                    pageload: (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>;
        isClosed: () => boolean;
        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>;
        setStorageState: (
            options:
                | string
                | {
                    cookies: {
                        domain: string;
                        expires: number;
                        httpOnly: boolean;
                        name: string;
                        path: string;
                        sameSite: "None"
                        | "Strict"
                        | "Lax";
                        secure: boolean;
                        value: string;
                    }[];
                    origins: {
                        localStorage: { name: string; value: string }[];
                        origin: string;
                    }[];
                },
        ) => Effect<void, PlaywrightError>;
        storageState: (
            options?: { indexedDB?: boolean; path?: string },
        ) => Effect<
            {
                cookies: {
                    domain: string;
                    expires: number;
                    httpOnly: boolean;
                    name: string;
                    path: string;
                    sameSite: "None"
                    | "Strict"
                    | "Lax";
                    secure: boolean;
                    value: string;
                }[];
                origins: {
                    localStorage: { name: string; value: string }[];
                    origin: string;
                }[];
            },
            PlaywrightError,
        >;
        tracing: PlaywrightTracingService;
    }
    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

    isClosed: () => boolean

    Indicates that the browser context is in the process of closing or has already been closed.

    BrowserContext.isClosed

    0.5.1

    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

    setStorageState: (
        options:
            | string
            | {
                cookies: {
                    domain: string;
                    expires: number;
                    httpOnly: boolean;
                    name: string;
                    path: string;
                    sameSite: "None"
                    | "Strict"
                    | "Lax";
                    secure: boolean;
                    value: string;
                }[];
                origins: {
                    localStorage: { name: string; value: string }[];
                    origin: string;
                }[];
            },
    ) => Effect<void, PlaywrightError>

    Sets the storage state for the browser context.

    BrowserContext.setStorageState

    0.5.0

    storageState: (
        options?: { indexedDB?: boolean; path?: string },
    ) => Effect<
        {
            cookies: {
                domain: string;
                expires: number;
                httpOnly: boolean;
                name: string;
                path: string;
                sameSite: "None"
                | "Strict"
                | "Lax";
                secure: boolean;
                value: string;
            }[];
            origins: {
                localStorage: { name: string; value: string }[];
                origin: string;
            }[];
        },
        PlaywrightError,
    >

    Returns storage state for this browser context, contains current cookies, local storage snapshot and IndexedDB snapshot.

    BrowserContext.storageState

    0.5.1

    tracing: PlaywrightTracingService

    Access the tracing.

    0.5.0

    custom

    eventStream: <
        K extends
            | "dialog"
            | "page"
            | "close"
            | "console"
            | "download"
            | "frameattached"
            | "framedetached"
            | "framenavigated"
            | "request"
            | "requestfailed"
            | "requestfinished"
            | "response"
            | "backgroundpage"
            | "pageclose"
            | "pageload"
            | "serviceworker"
            | "weberror",
    >(
        event: K,
    ) => Stream<
        ReturnType<
            {
                backgroundpage: (page: Page) => PlaywrightPageService;
                close: (context: BrowserContext) => PlaywrightBrowserContextService;
                console: (a: ConsoleMessage) => ConsoleMessage;
                dialog: (dialog: Dialog) => PlaywrightDialog;
                download: (download: Download) => PlaywrightDownload;
                frameattached: (frame: Frame) => PlaywrightFrameService;
                framedetached: (frame: Frame) => PlaywrightFrameService;
                framenavigated: (frame: Frame) => PlaywrightFrameService;
                page: (page: Page) => PlaywrightPageService;
                pageclose: (page: Page) => PlaywrightPageService;
                pageload: (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