Skip to main content
Version: 4.0 (RC)

crawlee-browser-pool.api

Public API Report File for "@crawlee/browser-pool"

Do not edit this file. It is a report generated by API Extractor.


import type { Browser } from 'playwright';
import type { BrowserContext } from 'playwright';
import type { BrowserFingerprintWithHeaders } from 'fingerprint-generator';
import type { BrowserType } from 'playwright';
import type { Cookie } from '@crawlee/types';
import { CrawleeLogger } from '@crawlee/core';
import { CriticalError } from '@crawlee/core';
import type { Dictionary } from '@crawlee/types';
import { EventEmitter } from 'node:events';
import { FingerprintGenerator as FingerprintGenerator_2 } from 'fingerprint-generator';
import type { FingerprintGeneratorOptions as FingerprintGeneratorOptions_2 } from 'fingerprint-generator';
import { FingerprintInjector } from 'fingerprint-injector';
import { IBrowserPool } from '@crawlee/types';
import { NewPageOptions } from '@crawlee/types';
import type { Page } from 'playwright';
import type { PageState } from '@crawlee/types';
import type Puppeteer from 'puppeteer';
import type * as PuppeteerTypes from 'puppeteer';
import QuickLRU from 'quick-lru';
import { TypedEmitter } from 'tiny-typed-emitter';

// @public (undocumented)
export interface AnonymizeProxySugarOptions {
// (undocumented)
ignoreProxyCertificate?: boolean;
}

// @public (undocumented)
export enum BROWSER_CONTROLLER_EVENTS {
// (undocumented)
BROWSER_CLOSED = "browserClosed"
}

// @public (undocumented)
export enum BROWSER_POOL_EVENTS {
// (undocumented)
BROWSER_CLOSED = "browserClosed",
// (undocumented)
BROWSER_LAUNCHED = "browserLaunched",
// (undocumented)
BROWSER_RETIRED = "browserRetired",
// (undocumented)
PAGE_CLOSED = "pageClosed",
// (undocumented)
PAGE_CREATED = "pageCreated"
}

// @public
export abstract class BrowserController<Library extends CommonLibrary = CommonLibrary, LibraryOptions extends Dictionary | undefined = Parameters<Library['launch']>[0], LaunchResult extends CommonBrowser = UnwrapPromise<ReturnType<Library['launch']>>, NewPageOptions = Parameters<LaunchResult['newPage']>[0], NewPageResult = UnwrapPromise<ReturnType<LaunchResult['newPage']>>> extends TypedEmitter<BrowserControllerEvents<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>> implements IBrowserController<NewPageResult> {
constructor(browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>);
// (undocumented)
activePages: number;
browser: LaunchResult;
readonly browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
close(): Promise<void>;
// (undocumented)
protected abstract _close(): Promise<void>;
// (undocumented)
getCookies(page: NewPageResult): Promise<Cookie[]>;
// (undocumented)
protected abstract _getCookies(page: NewPageResult): Promise<Cookie[]>;
// (undocumented)
readonly id: string;
// (undocumented)
isActive: boolean;
kill(): Promise<void>;
// (undocumented)
protected abstract _kill(): Promise<void>;
// (undocumented)
lastPageOpenedAt: number;
launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
// (undocumented)
protected readonly log: CrawleeLogger;
// (undocumented)
protected abstract _newPage(pageOptions?: NewPageOptions): Promise<NewPageResult>;
// (undocumented)
abstract normalizeProxyOptions(proxyUrl: string | undefined, pageOptions: any): Record<string, unknown>;
proxyUrl?: string;
// (undocumented)
setCookies(page: NewPageResult, cookies: Cookie[]): Promise<void>;
// (undocumented)
protected abstract _setCookies(page: NewPageResult, cookies: Cookie[]): Promise<void>;
// (undocumented)
totalPages: number;
}

// @public (undocumented)
export interface BrowserControllerEvents<Library extends CommonLibrary, LibraryOptions extends Dictionary | undefined = Parameters<Library['launch']>[0], LaunchResult extends CommonBrowser = UnwrapPromise<ReturnType<Library['launch']>>, NewPageOptions = Parameters<LaunchResult['newPage']>[0], NewPageResult = UnwrapPromise<ReturnType<LaunchResult['newPage']>>> {
// (undocumented)
[BROWSER_CONTROLLER_EVENTS.BROWSER_CLOSED]: (controller: BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>) => void;
}

// @public (undocumented)
export class BrowserLaunchError extends CriticalError {
constructor(...args: ConstructorParameters<typeof CriticalError>);
}

// @public (undocumented)
export enum BrowserName {
// (undocumented)
chrome = "chrome",
// (undocumented)
edge = "edge",
// (undocumented)
firefox = "firefox",
// (undocumented)
safari = "safari"
}

// Not exported by the entry point; reachable only as a referenced type.
// @public (undocumented)
interface BrowserOptions {
// (undocumented)
browserContext: BrowserContext;
// (undocumented)
version: string;
}

// @public
export abstract class BrowserPlugin<Library extends CommonLibrary = CommonLibrary, LibraryOptions extends Dictionary | undefined = Parameters<Library['launch']>[0], LaunchResult extends CommonBrowser = UnwrapPromise<ReturnType<Library['launch']>>, NewPageOptions = Parameters<LaunchResult['newPage']>[0], NewPageResult = UnwrapPromise<ReturnType<LaunchResult['newPage']>>> {
constructor(library: Library, options?: BrowserPluginOptions<LibraryOptions>);
// (undocumented)
protected abstract addProxyToLaunchOptions(launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>): Promise<void>;
// (undocumented)
readonly browserPerProxy?: boolean;
protected connectToRemoteBrowser(launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>, connect: (url: string) => Promise<LaunchResult>): Promise<LaunchResult>;
// (undocumented)
abstract createController(): BrowserController<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
createLaunchContext(options?: CreateLaunchContextOptions<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>): LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
// (undocumented)
readonly ignoreProxyCertificate?: boolean;
// (undocumented)
protected abstract isChromiumBasedBrowser(launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>): boolean;
launch(launchContext?: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>): Promise<LaunchResult>;
// (undocumented)
protected abstract _launch(launchContext: LaunchContext<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>): Promise<LaunchResult>;
// (undocumented)
readonly launchOptions: LibraryOptions;
// (undocumented)
readonly library: Library;
// (undocumented)
protected readonly log: CrawleeLogger;
// (undocumented)
readonly name: string;
// (undocumented)
readonly proxyUrl?: string;
// (undocumented)
protected throwAugmentedLaunchError(cause: unknown, executablePath: string | undefined, dockerImage: string, moduleInstallCommand: string): never;
// (undocumented)
useIncognitoPages: boolean;
// (undocumented)
readonly userDataDir?: string;
}

// @public (undocumented)
export interface BrowserPluginOptions<LibraryOptions> {
browserPerProxy?: boolean;
ignoreProxyCertificate?: boolean;
launchOptions?: LibraryOptions;
proxyUrl?: string;
useIncognitoPages?: boolean;
userDataDir?: string;
}

// @public
export class BrowserPool<Options extends BrowserPoolOptions = BrowserPoolOptions, BrowserPlugins extends BrowserPlugin[] = InferBrowserPluginArray<Options['browserPlugins']>, BrowserControllerReturn extends BrowserController = ReturnType<BrowserPlugins[number]['createController']>, LaunchContextReturn extends LaunchContext = ReturnType<BrowserPlugins[number]['createLaunchContext']>, PageOptions = Parameters<BrowserControllerReturn['newPage']>[0], PageReturn extends UnwrapPromise<ReturnType<BrowserControllerReturn['newPage']>> = UnwrapPromise<ReturnType<BrowserControllerReturn['newPage']>>> extends TypedEmitter<BrowserPoolEvents<BrowserControllerReturn, PageReturn>> implements IBrowserPool<PageReturn> {
// (undocumented)
[Symbol.asyncDispose](): Promise<void>;
constructor(options: Options & BrowserPoolHooks<BrowserControllerReturn, LaunchContextReturn, PageReturn>);
// (undocumented)
activeBrowserControllers: Set<BrowserControllerReturn>;
// (undocumented)
browserPlugins: BrowserPlugins;
closeAllBrowsers(): Promise<void>;
// (undocumented)
closeInactiveBrowserAfterMillis: number;
closePage(page: PageReturn, options?: {
error?: Error;
}): Promise<void>;
destroy(): Promise<void>;
extractPageState(page: PageReturn): Promise<PageState>;
// (undocumented)
fingerprintCache?: QuickLRU<string, BrowserFingerprintWithHeaders>;
// (undocumented)
fingerprintGenerator?: FingerprintGenerator_2;
// (undocumented)
fingerprintInjector?: FingerprintInjector;
// (undocumented)
fingerprintOptions: FingerprintOptions;
getBrowserControllerByPage(page: PageReturn): BrowserControllerReturn | undefined;
getPage(id: string): PageReturn | undefined;
getPageId(page: PageReturn): string | undefined;
hasActiveBrowserWithFreeCapacity(): boolean;
hasFreeBrowserSlot(): boolean;
injectPageState(page: PageReturn, state: PageState): Promise<void>;
// (undocumented)
maxOpenBrowsers: number;
// (undocumented)
maxOpenPagesPerBrowser: number;
newPage(options?: BrowserPoolNewPageOptions<PageOptions, BrowserPlugins[number]>): Promise<PageReturn>;
newPageInNewBrowser(options?: BrowserPoolNewPageInNewBrowserOptions<PageOptions, BrowserPlugins[number]>): Promise<PageReturn>;
newPageWithEachPlugin(optionsList?: Omit<BrowserPoolNewPageOptions<PageOptions, BrowserPlugins[number]>, 'browserPlugin'>[]): Promise<PageReturn[]>;
// (undocumented)
operationTimeoutMillis: number;
// (undocumented)
pageCounter: number;
// (undocumented)
pageIds: WeakMap<PageReturn, string>;
// (undocumented)
pages: Map<string, PageReturn>;
// (undocumented)
pageToBrowserController: WeakMap<PageReturn, BrowserControllerReturn>;
// (undocumented)
postLaunchHooks: PostLaunchHook<BrowserControllerReturn>[];
// (undocumented)
postPageCloseHooks: PostPageCloseHook<BrowserControllerReturn>[];
// (undocumented)
postPageCreateHooks: PostPageCreateHook<BrowserControllerReturn, PageReturn>[];
// (undocumented)
preLaunchHooks: PreLaunchHook<LaunchContextReturn>[];
// (undocumented)
prePageCloseHooks: PrePageCloseHook<BrowserControllerReturn, PageReturn>[];
// (undocumented)
prePageCreateHooks: PrePageCreateHook<BrowserControllerReturn, PageOptions>[];
retireAllBrowsers(): void;
// (undocumented)
retireBrowserAfterPageCount: number;
retireBrowserByPage(page: PageReturn): void;
retireBrowserController(browserController: BrowserControllerReturn): void;
// (undocumented)
retiredBrowserControllers: Set<BrowserControllerReturn>;
// (undocumented)
startingBrowserControllers: Set<BrowserControllerReturn>;
// (undocumented)
useFingerprints?: boolean;
}

// @public (undocumented)
export interface BrowserPoolEvents<BC extends BrowserController, Page> {
// (undocumented)
[BROWSER_POOL_EVENTS.BROWSER_LAUNCHED]: (browserController: BC) => void | Promise<void>;
// (undocumented)
[BROWSER_POOL_EVENTS.BROWSER_RETIRED]: (browserController: BC) => void | Promise<void>;
// (undocumented)
[BROWSER_POOL_EVENTS.PAGE_CLOSED]: (page: Page) => void | Promise<void>;
// (undocumented)
[BROWSER_POOL_EVENTS.PAGE_CREATED]: (page: Page) => void | Promise<void>;
}

// @public (undocumented)
export interface BrowserPoolHooks<BC extends BrowserController, LC extends LaunchContext, PR extends UnwrapPromise<ReturnType<BC['newPage']>> = UnwrapPromise<ReturnType<BC['newPage']>>> {
postLaunchHooks?: PostLaunchHook<BC>[];
postPageCloseHooks?: PostPageCloseHook<BC>[];
postPageCreateHooks?: PostPageCreateHook<BC, PR>[];
preLaunchHooks?: PreLaunchHook<LC>[];
prePageCloseHooks?: PrePageCloseHook<BC, PR>[];
prePageCreateHooks?: PrePageCreateHook<BC>[];
}

// @public (undocumented)
export interface BrowserPoolNewPageInNewBrowserOptions<PageOptions, BP extends BrowserPlugin> {
browserPlugin?: BP;
id?: string;
launchOptions?: BP['launchOptions'];
pageOptions?: PageOptions;
}

// @public (undocumented)
export interface BrowserPoolNewPageOptions<PageOptions, BP extends BrowserPlugin> extends NewPageOptions {
browserPlugin?: BP;
ignoreTlsErrors?: boolean;
pageOptions?: PageOptions;
proxyUrl?: string;
}

// @public (undocumented)
export interface BrowserPoolOptions<Plugin extends BrowserPlugin = BrowserPlugin> {
browserPlugins: readonly Plugin[];
closeInactiveBrowserAfterSecs?: number;
// (undocumented)
fingerprintOptions?: FingerprintOptions;
maxOpenPagesPerBrowser?: number;
operationTimeoutSecs?: number;
retireBrowserAfterPageCount?: number;
retireInactiveBrowserAfterSecs?: number;
useFingerprints?: boolean;
}

// @public (undocumented)
export interface BrowserSpecification {
httpVersion?: HttpVersion;
maxVersion?: number;
minVersion?: number;
name: BrowserName;
}

// Not exported by the entry point; reachable only as a referenced type.
// @public (undocumented)
interface CommonBrowser {
// (undocumented)
newPage(...args: unknown[]): Promise<CommonPage>;
}

// @public
export interface CommonLibrary {
// (undocumented)
launch(opts?: Dictionary): Promise<CommonBrowser>;
// (undocumented)
name?: () => string;
// (undocumented)
product?: string;
}

// @public (undocumented)
export interface CommonPage {
// (undocumented)
close(...args: unknown[]): Promise<unknown>;
// (undocumented)
evaluate(pageFunction: ((...args: any[]) => unknown) | string, ...args: unknown[]): Promise<unknown>;
// (undocumented)
url(): string | Promise<string>;
}

// @public
export type CrawlerRemoteBrowserOptions = Omit<RemoteBrowserPoolOptions, 'browserPlugins' | 'browserPoolOptions'>;

// @public (undocumented)
export interface CreateLaunchContextOptions<Library extends CommonLibrary, LibraryOptions extends Dictionary | undefined = Parameters<Library['launch']>[0], LaunchResult extends CommonBrowser = UnwrapPromise<ReturnType<Library['launch']>>, NewPageOptions = Parameters<LaunchResult['newPage']>[0], NewPageResult = UnwrapPromise<ReturnType<LaunchResult['newPage']>>> extends Partial<Omit<LaunchContextOptions<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>, 'browserPlugin'>> {
}

// @public
export const DEFAULT_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36";

// @public (undocumented)
export enum DeviceCategory {
desktop = "desktop",
mobile = "mobile"
}

// @public (undocumented)
export interface FingerprintGenerator {
// (undocumented)
getFingerprint: (fingerprintGeneratorOptions?: FingerprintGeneratorOptions) => GetFingerprintReturn;
}

// @public (undocumented)
export interface FingerprintGeneratorOptions extends Partial<FingerprintGeneratorOptions_2> {
}

// @public
export interface FingerprintOptions {
fingerprintCacheSize?: number;
fingerprintGeneratorOptions?: FingerprintGeneratorOptions;
useFingerprintCache?: boolean;
}

// @public (undocumented)
export interface GetFingerprintReturn {
// (undocumented)
fingerprint: BrowserFingerprintWithHeaders;
}

// Not exported by the entry point; reachable only as a referenced type.
// @public
type HttpVersion = (typeof SUPPORTED_HTTP_VERSIONS)[number];

// @public
export interface IBrowserController<Page = unknown> {
readonly browser: unknown;
close(): Promise<void>;
getCookies(page: Page): Promise<Cookie[]>;
readonly id: string;
readonly launchContext: IBrowserLaunchContext;
setCookies(page: Page, cookies: Cookie[]): Promise<void>;
}

// @public
export interface IBrowserLaunchContext {
fingerprint?: unknown;
launchOptions?: Dictionary | undefined;
proxyUrl?: string;
useIncognitoPages?: boolean;
}

export { IBrowserPool }

// @public (undocumented)
export type InferBrowserPluginArray<Input extends readonly unknown[], Result extends BrowserPlugin[] = []> = Input extends readonly [infer FirstValue, ...infer Rest] | [infer FirstValue, ...infer Rest] ? FirstValue extends PlaywrightPlugin ? InferBrowserPluginArray<Rest, [...Result, PlaywrightPlugin]> : FirstValue extends PuppeteerPlugin ? InferBrowserPluginArray<Rest, [...Result, PuppeteerPlugin]> : never : Input extends [] ? Result : Input extends readonly (infer U)[] ? [
U
] extends [PuppeteerPlugin | PlaywrightPlugin] ? U[] : never : Result;

// @public (undocumented)
export class LaunchContext<Library extends CommonLibrary = CommonLibrary, LibraryOptions extends Dictionary | undefined = Parameters<Library['launch']>[0], LaunchResult extends CommonBrowser = UnwrapPromise<ReturnType<Library['launch']>>, NewPageOptions = Parameters<LaunchResult['newPage']>[0], NewPageResult = UnwrapPromise<ReturnType<LaunchResult['newPage']>>> {
constructor(options: LaunchContextOptions<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>);
// (undocumented)
[K: PropertyKey]: unknown;
// (undocumented)
browserPerProxy?: boolean;
// (undocumented)
browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
extend<T extends Record<PropertyKey, unknown>>(fields: T): void;
// (undocumented)
fingerprint?: BrowserFingerprintWithHeaders;
// (undocumented)
id?: string;
// (undocumented)
ignoreProxyCertificate?: boolean;
// (undocumented)
readonly isRemote: boolean;
// (undocumented)
launchOptions: LibraryOptions;
set proxyUrl(url: string | undefined);
get proxyUrl(): string | undefined;
// (undocumented)
useIncognitoPages: boolean;
// (undocumented)
userDataDir: string;
}

// @public
export interface LaunchContextOptions<Library extends CommonLibrary = CommonLibrary, LibraryOptions extends Dictionary | undefined = Parameters<Library['launch']>[0], LaunchResult extends CommonBrowser = UnwrapPromise<ReturnType<Library['launch']>>, NewPageOptions = Parameters<LaunchResult['newPage']>[0], NewPageResult = UnwrapPromise<ReturnType<LaunchResult['newPage']>>> {
browserPerProxy?: boolean;
browserPlugin: BrowserPlugin<Library, LibraryOptions, LaunchResult, NewPageOptions, NewPageResult>;
id?: string;
ignoreProxyCertificate?: boolean;
isRemote?: boolean;
launchOptions: LibraryOptions;
// (undocumented)
proxyUrl?: string;
useIncognitoPages?: boolean;
userDataDir?: string;
}

export { NewPageOptions }

// @public (undocumented)
export enum OperatingSystemsName {
android = "android",
ios = "ios",
// (undocumented)
linux = "linux",
// (undocumented)
macos = "macos",
// (undocumented)
windows = "windows"
}

// @public
export class PlaywrightBrowser extends EventEmitter {
// (undocumented)
[Symbol.asyncDispose](): Promise<void>;
constructor(options: BrowserOptions);
// (undocumented)
browserType(): BrowserType;
// (undocumented)
close(): Promise<void>;
// (undocumented)
contexts(): BrowserContext[];
// (undocumented)
isConnected(): boolean;
// (undocumented)
newBrowserCDPSession(): Promise<never>;
// (undocumented)
newContext(): Promise<never>;
// (undocumented)
newPage(...args: Parameters<BrowserContext['newPage']>): ReturnType<BrowserContext['newPage']>;
// (undocumented)
startTracing(): Promise<never>;
// (undocumented)
stopTracing(): Promise<never>;
// (undocumented)
version(): string;
}

// @public (undocumented)
export class PlaywrightController extends BrowserController<BrowserType, SafeParameters<BrowserType['launch']>[0], Browser> {
// (undocumented)
protected _close(): Promise<void>;
// (undocumented)
protected _getCookies(page: Page): Promise<Cookie[]>;
// (undocumented)
protected _kill(): Promise<void>;
// (undocumented)
protected _newPage(contextOptions?: SafeParameters<Browser['newPage']>[0]): Promise<Page>;
// (undocumented)
normalizeProxyOptions(proxyUrl: string | undefined, pageOptions: any): Record<string, unknown>;
// (undocumented)
protected _setCookies(page: Page, cookies: Cookie[]): Promise<void>;
}

// @public (undocumented)
export class PlaywrightPlugin extends BrowserPlugin<BrowserType, SafeParameters<BrowserType['launch']>[0], Browser> {
// (undocumented)
protected addProxyToLaunchOptions(launchContext: LaunchContext<BrowserType>): Promise<void>;
// (undocumented)
createController(): PlaywrightController;
// (undocumented)
protected isChromiumBasedBrowser(): boolean;
// (undocumented)
protected _launch(launchContext: LaunchContext<BrowserType>): Promise<Browser>;
useRemoteConnection(connection: RemoteConnection, parameters?: RemoteConnectionParameters): void;
}

// @public
export type PostLaunchHook<BC extends BrowserController> = (pageId: string, browserController: BC) => void | Promise<void>;

// @public
export type PostPageCloseHook<BC extends BrowserController> = (pageId: string, browserController: BC) => void | Promise<void>;

// @public
export type PostPageCreateHook<BC extends BrowserController, Page = UnwrapPromise<ReturnType<BC['newPage']>>> = (page: Page, browserController: BC) => void | Promise<void>;

// @public
export type PreLaunchHook<LC extends LaunchContext> = (pageId: string, launchContext: LC) => void | Promise<void>;

// @public
export type PrePageCloseHook<BC extends BrowserController, Page = UnwrapPromise<ReturnType<BC['newPage']>>> = (page: Page, browserController: BC) => void | Promise<void>;

// @public
export type PrePageCreateHook<BC extends BrowserController, PO = Parameters<BC['newPage']>[0]> = (pageId: string, browserController: BC, pageOptions?: PO) => void | Promise<void>;

// @public (undocumented)
export class PuppeteerController extends BrowserController<typeof Puppeteer, PuppeteerTypes.LaunchOptions, PuppeteerTypes.Browser, PuppeteerNewPageOptions> {
// (undocumented)
protected _close(): Promise<void>;
// (undocumented)
protected _getCookies(page: PuppeteerTypes.Page): Promise<Cookie[]>;
// (undocumented)
protected _kill(): Promise<void>;
// (undocumented)
protected _newPage(contextOptions?: PuppeteerNewPageOptions): Promise<PuppeteerTypes.Page>;
// (undocumented)
normalizeProxyOptions(proxyUrl: string | undefined, pageOptions: any): Record<string, unknown>;
// (undocumented)
protected _setCookies(page: PuppeteerTypes.Page, cookies: Cookie[]): Promise<void>;
}

// Not exported by the entry point; reachable only as a referenced type.
// @public (undocumented)
interface PuppeteerNewPageOptions extends PuppeteerTypes.BrowserContextOptions {
// (undocumented)
proxyPassword?: string;
// (undocumented)
proxyUsername?: string;
}

// @public (undocumented)
export class PuppeteerPlugin extends BrowserPlugin<typeof Puppeteer, PuppeteerTypes.LaunchOptions, PuppeteerTypes.Browser, PuppeteerNewPageOptions> {
// (undocumented)
protected addProxyToLaunchOptions(_launchContext: LaunchContext<typeof Puppeteer, PuppeteerTypes.LaunchOptions, PuppeteerTypes.Browser, PuppeteerNewPageOptions>): Promise<void>;
// (undocumented)
createController(): PuppeteerController;
// (undocumented)
protected isChromiumBasedBrowser(_launchContext: LaunchContext<typeof Puppeteer, PuppeteerTypes.LaunchOptions, PuppeteerTypes.Browser, PuppeteerNewPageOptions>): boolean;
// (undocumented)
protected _launch(launchContext: LaunchContext<typeof Puppeteer, PuppeteerTypes.LaunchOptions, PuppeteerTypes.Browser, PuppeteerNewPageOptions>): Promise<PuppeteerTypes.Browser>;
useRemoteConnection(connection: RemoteConnection, parameters?: RemoteConnectionParameters): void;
}

// @public
export type RemoteBrowserEndpoint = string | ((options?: {
proxyUrl?: string;
}) => string | ResolvedRemoteEndpoint | Promise<string | ResolvedRemoteEndpoint>);

// @public
export class RemoteBrowserPool<Page = unknown> implements IBrowserPool<Page> {
// (undocumented)
[Symbol.asyncDispose](): Promise<void>;
constructor(options: RemoteBrowserPoolOptions);
readonly browserPool: BrowserPool;
// (undocumented)
closePage(page: Page, options?: {
error?: Error;
}): Promise<void>;
destroy(): Promise<void>;
// (undocumented)
extractPageState(page: Page): Promise<PageState>;
// (undocumented)
injectPageState(page: Page, state: PageState): Promise<void>;
get maxOpenBrowsers(): number;
set maxOpenBrowsers(value: number);
newPage(options?: NewPageOptions): Promise<Page>;
}

// @public (undocumented)
export interface RemoteBrowserPoolOptions {
browserPlugins: BrowserPlugin[];
browserPoolOptions?: Omit<BrowserPoolOptions, 'browserPlugins'> & BrowserPoolHooks<any, any, any>;
connection?: RemoteConnectionParameters;
endpoint: RemoteBrowserEndpoint | RemoteBrowserProvider<any>;
maxOpenBrowsers?: number;
release?: (info: {
endpoint: string;
context?: Record<string, unknown>;
}) => unknown;
slotPollIntervalMillis?: number;
}

// @public
export abstract class RemoteBrowserProvider<TContext extends Record<string, unknown> = Record<string, unknown>> {
abstract connect(options?: {
proxyUrl?: string;
}): Promise<{
url: string;
context?: TContext;
}> | {
url: string;
context?: TContext;
};
maxOpenBrowsers?: number;
release(_context: TContext): Promise<void>;
}

// @public
export interface RemoteConnection {
release(token: number): Promise<void>;
resolve(options?: {
proxyUrl?: string;
}): Promise<{
url: string;
token: number;
}>;
}

// @public
export interface RemoteConnectionParameters {
connectOptions?: Record<string, unknown>;
protocol?: 'cdp' | 'playwright';
}

// @public
export interface ResolvedRemoteEndpoint {
context?: Record<string, unknown>;
url: string;
}

// Not exported by the entry point; reachable only as a referenced type.
// @public
type SafeParameters<T extends (...args: any) => any> = unknown[] extends Parameters<T> ? any : Parameters<T>;

// Not exported by the entry point; reachable only as a referenced type.
// @public (undocumented)
const SUPPORTED_HTTP_VERSIONS: readonly ["1", "2"];

// @public (undocumented)
export type UnwrapPromise<T> = T extends PromiseLike<infer R> ? UnwrapPromise<R> : T;

// (No @packageDocumentation comment for this package)