Skip to main content
Version: 3.1

PuppeteerController

The BrowserController serves two purposes. First, it is the base class that specialized controllers like PuppeteerController or PlaywrightController extend. Second, it defines the public interface of the specialized classes which provide only private methods. Therefore, we do not keep documentation for the specialized classes, because it's the same for all of them.

@hideconstructor

Hierarchy

  • BrowserController<typeof Puppeteer>
    • PuppeteerController

Index

Constructors

constructor

  • new PuppeteerController(browserPlugin: BrowserPlugin<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>): PuppeteerController
  • Parameters

    • browserPlugin: BrowserPlugin<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>

    Returns PuppeteerController

Properties

activePages

activePages: number = 0

browser

browser: Browser = ...

Browser representation of the underlying automation library.

browserPlugin

browserPlugin: BrowserPlugin<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>

The BrowserPlugin instance used to launch the browser.

id

id: string = ...

isActive

isActive: boolean = false

lastPageOpenedAt

lastPageOpenedAt: number = ...

launchContext

launchContext: LaunchContext<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page> = ...

The configuration the browser was launched with.

totalPages

totalPages: number = 0

staticexternaldefaultMaxListeners

defaultMaxListeners: number

Methods

externaladdListener

  • addListener<U>(event: U, listener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]): PuppeteerController
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]

    Returns PuppeteerController

close

  • close(): Promise<void>
  • Gracefully closes the browser and makes sure there will be no lingering browser processes.

    Emits 'browserClosed' event.


    Returns Promise<void>

externalemit

  • emit<U>(event: U, ...args: Parameters<BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]>): boolean
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externalrest...args: Parameters<BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]>

    Returns boolean

externaleventNames

  • eventNames<U>(): U[]
  • Type parameters

    • U: BROWSER_CLOSED

    Returns U[]

getCookies

  • getCookies(page: Page): Promise<Cookie[]>
  • Parameters

    • page: Page

    Returns Promise<Cookie[]>

externalgetMaxListeners

  • getMaxListeners(): number
  • Returns number

kill

  • kill(): Promise<void>
  • Immediately kills the browser process.

    Emits 'browserClosed' event.


    Returns Promise<void>

externallistenerCount

  • listenerCount(type: BROWSER_CLOSED): number
  • Parameters

    • externaltype: BROWSER_CLOSED

    Returns number

externallisteners

  • listeners<U>(type: U): BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U][]
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externaltype: U

    Returns BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U][]

normalizeProxyOptions

  • normalizeProxyOptions(proxyUrl: undefined | string, pageOptions: any): Record<string, unknown>
  • Parameters

    • proxyUrl: undefined | string
    • pageOptions: any

    Returns Record<string, unknown>

externaloff

  • off<U>(event: U, listener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]): PuppeteerController
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]

    Returns PuppeteerController

externalon

  • on<U>(event: U, listener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]): PuppeteerController
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]

    Returns PuppeteerController

externalonce

  • once<U>(event: U, listener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]): PuppeteerController
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]

    Returns PuppeteerController

externalprependListener

  • prependListener<U>(event: U, listener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]): PuppeteerController
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]

    Returns PuppeteerController

externalprependOnceListener

  • prependOnceListener<U>(event: U, listener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]): PuppeteerController
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]

    Returns PuppeteerController

externalrawListeners

  • rawListeners<U>(type: U): BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U][]
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externaltype: U

    Returns BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U][]

externalremoveAllListeners

  • removeAllListeners(event?: BROWSER_CLOSED): PuppeteerController
  • Parameters

    • externaloptionalevent: BROWSER_CLOSED

    Returns PuppeteerController

externalremoveListener

  • removeListener<U>(event: U, listener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]): PuppeteerController
  • Type parameters

    • U: BROWSER_CLOSED

    Parameters

    • externalevent: U
    • externallistener: BrowserControllerEvents<__module, undefined | (LaunchOptions & BrowserLaunchArgumentOptions & BrowserConnectOptions & { extraPrefsFirefox?: Record<string, unknown>; product?: Product }), Browser, undefined | ContextOptions, Page>[U]

    Returns PuppeteerController

setCookies

  • setCookies(page: Page, cookies: Cookie[]): Promise<void>
  • Parameters

    • page: Page
    • cookies: Cookie[]

    Returns Promise<void>

externalsetMaxListeners

  • setMaxListeners(n: number): PuppeteerController
  • Parameters

    • externaln: number

    Returns PuppeteerController